org.opends.server.plugins.profiler
Class ProfilerPlugin

java.lang.Object
  extended by org.opends.server.api.plugin.DirectoryServerPlugin<ProfilerPluginCfg>
      extended by org.opends.server.plugins.profiler.ProfilerPlugin
All Implemented Interfaces:
ConfigurationChangeListener<ProfilerPluginCfg>

public final class ProfilerPlugin
extends DirectoryServerPlugin<ProfilerPluginCfg>
implements ConfigurationChangeListener<ProfilerPluginCfg>

This class defines a Directory Server startup plugin that will register itself as a configurable component that can allow for a simple sample-based profiling mechanism within the Directory Server. When profiling is enabled, the server will periodically (e.g., every few milliseconds) retrieve all the stack traces for all threads in the server and aggregates them so that they can be analyzed to see where the server is spending all of its processing time.


Field Summary
static java.lang.String PROFILE_ACTION_CANCEL
          The value to use for the profiler action when it should stop capturing data and discard any information that has been collected.
static java.lang.String PROFILE_ACTION_NONE
          The value to use for the profiler action when no action is necessary.
static java.lang.String PROFILE_ACTION_START
          The value to use for the profiler action when it should start capturing information.
static java.lang.String PROFILE_ACTION_STOP
          The value to use for the profiler action when it should stop capturing data and write the information it has collected to disk.
 
Constructor Summary
ProfilerPlugin()
          Creates a new instance of this Directory Server plugin.
 
Method Summary
 ConfigChangeResult applyConfigurationChange(ProfilerPluginCfg configuration)
          Applies the configuration changes to this change listener.
 PluginResult.Startup doStartup()
          Performs any processing that should be done when the Directory Server is in the process of starting.
 void finalizePlugin()
          Performs any necessary finalization for this plugin.
 void initializePlugin(java.util.Set<PluginType> pluginTypes, ProfilerPluginCfg configuration)
          Performs any initialization necessary for this plugin.
 boolean isConfigurationAcceptable(PluginCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the provided configuration is acceptable for this plugin.
 boolean isConfigurationChangeAcceptable(ProfilerPluginCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed change to the configuration is acceptable to this change listener.
 
Methods inherited from class org.opends.server.api.plugin.DirectoryServerPlugin
doLDIFExport, doLDIFImport, doPostConnect, doPostDisconnect, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostSynchronization, doPostSynchronization, doPostSynchronization, doPostSynchronization, doPreOperation, doPreOperation, doPreOperation, doPreOperation, doPreOperation, doPreOperation, doPreOperation, doPreOperation, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doShutdown, getPluginEntryDN, getPluginTypes, initializeInternal, invokeForInternalOperations, processIntermediateResponse, processSearchEntry, processSearchReference, processSubordinateModifyDN, setInvokeForInternalOperations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROFILE_ACTION_NONE

public static final java.lang.String PROFILE_ACTION_NONE
The value to use for the profiler action when no action is necessary.

See Also:
Constant Field Values

PROFILE_ACTION_START

public static final java.lang.String PROFILE_ACTION_START
The value to use for the profiler action when it should start capturing information.

See Also:
Constant Field Values

PROFILE_ACTION_STOP

public static final java.lang.String PROFILE_ACTION_STOP
The value to use for the profiler action when it should stop capturing data and write the information it has collected to disk.

See Also:
Constant Field Values

PROFILE_ACTION_CANCEL

public static final java.lang.String PROFILE_ACTION_CANCEL
The value to use for the profiler action when it should stop capturing data and discard any information that has been collected.

See Also:
Constant Field Values
Constructor Detail

ProfilerPlugin

public ProfilerPlugin()
Creates a new instance of this Directory Server plugin. Every plugin must implement a default constructor (it is the only one that will be used to create plugins defined in the configuration), and every plugin constructor must call super() as its first element.

Method Detail

initializePlugin

public final void initializePlugin(java.util.Set<PluginType> pluginTypes,
                                   ProfilerPluginCfg configuration)
                            throws ConfigException
Performs any initialization necessary for this plugin. This will be called as soon as the plugin has been loaded and before it is registered with the server.

Specified by:
initializePlugin in class DirectoryServerPlugin<ProfilerPluginCfg>
Parameters:
pluginTypes - The set of plugin types that indicate the ways in which this plugin will be invoked.
configuration - The configuration for this plugin.
Throws:
ConfigException - If the provided entry does not contain a valid configuration for this plugin.

finalizePlugin

public final void finalizePlugin()
Performs any necessary finalization for this plugin. This will be called just after the plugin has been deregistered with the server but before it has been unloaded.

Overrides:
finalizePlugin in class DirectoryServerPlugin<ProfilerPluginCfg>

doStartup

public final PluginResult.Startup doStartup()
Performs any processing that should be done when the Directory Server is in the process of starting. This method will be called after virtually all other initialization has been performed but before the connection handlers are started.

Overrides:
doStartup in class DirectoryServerPlugin<ProfilerPluginCfg>
Returns:
The result of the startup plugin processing.

isConfigurationAcceptable

public boolean isConfigurationAcceptable(PluginCfg configuration,
                                         java.util.List<Message> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this plugin. It should be possible to call this method on an uninitialized plugin instance in order to determine whether the plugin would be able to use the provided configuration.

Overrides:
isConfigurationAcceptable in class DirectoryServerPlugin<ProfilerPluginCfg>
Parameters:
configuration - The plugin configuration for which to make the determination.
unacceptableReasons - A list that may be used to hold the reasons that the provided configuration is not acceptable.
Returns:
true if the provided configuration is acceptable for this plugin, or false if not.

isConfigurationChangeAcceptable

public boolean isConfigurationChangeAcceptable(ProfilerPluginCfg configuration,
                                               java.util.List<Message> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.

Specified by:
isConfigurationChangeAcceptable in interface ConfigurationChangeListener<ProfilerPluginCfg>
Parameters:
configuration - The new configuration containing the changes.
unacceptableReasons - A list that can be used to hold messages about why the provided configuration is not acceptable.
Returns:
Returns true if the proposed change is acceptable, or false if it is not.

applyConfigurationChange

public ConfigChangeResult applyConfigurationChange(ProfilerPluginCfg configuration)
Applies the configuration changes to this change listener.

Specified by:
applyConfigurationChange in interface ConfigurationChangeListener<ProfilerPluginCfg>
Parameters:
configuration - The new configuration containing the changes.
Returns:
Returns information about the result of changing the configuration.