001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id$
020 */
021package org.nuxeo.ecm.core.management.events;
022
023/**
024 * Monitoring interface.
025 *
026 * @author Thierry Delprat
027 */
028public interface EventMonitoringMBean {
029
030    /**
031     * Gets the number of events in process or waiting for available slots.
032     */
033    int getEventsInQueueCount();
034
035    /**
036     * Gets number of active threads.
037     */
038    int getActiveThreadsCount();
039
040    /**
041     * Tells if time tracking is active for Async event handlers.
042     */
043    boolean isAsyncHandlersTrackingEnabled();
044
045    /**
046     * Enables or disables time tracking for Async event handlers.
047     */
048    void setAsyncHandlersTrackingEnabled(boolean collectAsyncHandlersExecTime);
049
050    /**
051     * Tells if time tracking is active for Sync event handlers.
052     */
053    boolean isSyncHandlersTrackingEnabled();
054
055    /**
056     * Enables or disables time tracking for Sync event handlers.
057     */
058    void setSyncHandlersTrackingEnabled(boolean collectSyncHandlersExecTime);
059
060    /**
061     * Returns the statistics for Async Handlers.
062     */
063    String getAsyncHandlersExecTime();
064
065    /**
066     * Returns the statistics for Sync Handlers.
067     */
068    String getSyncHandlersExecTime();
069
070    /**
071     * Resets the statistics.
072     */
073    void resetHandlersExecTime();
074
075    /**
076     * Tells if async handlers execution is blocked.
077     */
078    boolean isBlockAsyncHandlers();
079
080    /**
081     * Blocks or enables async handlers execution.
082     */
083    void setBlockAsyncHandlers(boolean blockAsyncHandlers);
084
085    /**
086     * Tells if post-commit sync handlers execution is blocked.
087     */
088    boolean isBlockSyncPostCommitHandlers();
089
090    /**
091     * Blocks or enables post-commit sync handlers execution.
092     */
093    void setBlockSyncPostCommitHandlers(boolean blockSyncPostCommitHandlers);
094
095    /**
096     * Get a summary of all registered listeners (name - type - enabled).
097     */
098    String getListenersConfig();
099
100    /**
101     * Enables or disables a listener by its name.
102     */
103    void setListenerEnabledFlag(String listenerName, boolean enabled);
104
105    /**
106     * Getter for bulkMode processing. Bulk mode may be used by listeners to drop some processing.
107     */
108    boolean isBulkModeEnabled();
109
110    /**
111     * Enables/Disables bulkMode processing.
112     */
113    void setBulkModeEnabled(boolean bulkModeEnabled);
114
115}