| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.plugins.profiler; |
| | | |
| | |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.Debug.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.loggers.Error.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.PluginMessages.*; |
| | |
| | | extends DirectoryServerPlugin |
| | | implements ConfigurableComponent |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.plugins.profiler.ProfilerPlugin"; |
| | | |
| | | |
| | | |
| | |
| | | { |
| | | super(); |
| | | |
| | | assert debugConstructor(CLASS_NAME); |
| | | } |
| | | |
| | | |
| | |
| | | ConfigEntry configEntry) |
| | | throws ConfigException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "initializePlugin", |
| | | String.valueOf(pluginTypes), String.valueOf(configEntry)); |
| | | |
| | | |
| | | // Initialize the set of profiler actions. |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializePlugin", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_PLUGIN_PROFILER_CANNOT_DETERMINE_PROFILE_DIR; |
| | | String message = getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializePlugin", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_PLUGIN_PROFILER_CANNOT_DETERMINE_AUTOSTART; |
| | | String message = getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializePlugin", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_PLUGIN_PROFILER_CANNOT_DETERMINE_INTERVAL; |
| | | String message = getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | @Override() |
| | | public final void finalizePlugin() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "finalizePlugin"); |
| | | |
| | | |
| | | // If the profiler thread is still active, then cause it to dump the |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "finalizePlugin", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_PLUGIN_PROFILER_CANNOT_WRITE_PROFILE_DATA; |
| | | String message = getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | @Override() |
| | | public final StartupPluginResult doStartup() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "doStartup"); |
| | | |
| | | // If the profiler should be started automatically, then do so now. |
| | | if (autoStart) |
| | |
| | | */ |
| | | public final DN getConfigurableComponentEntryDN() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConfigurableComponentEntryDN"); |
| | | |
| | | return configEntryDN; |
| | | } |
| | |
| | | */ |
| | | public final List<ConfigAttribute> getConfigurationAttributes() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConfigurationAttributes"); |
| | | |
| | | LinkedList<ConfigAttribute> attrList = new LinkedList<ConfigAttribute>(); |
| | | |
| | |
| | | public final boolean hasAcceptableConfiguration(ConfigEntry configEntry, |
| | | List<String> unacceptableReasons) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "hasAcceptableConfiguration", |
| | | String.valueOf(configEntry), "java.lang.List<String>"); |
| | | |
| | | |
| | | // See if there is an acceptable value for the sample interval. |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "hasAcceptableConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_PLUGIN_PROFILER_CANNOT_DETERMINE_INTERVAL; |
| | | unacceptableReasons.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "hasAcceptableConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_PLUGIN_PROFILER_CANNOT_DETERMINE_PROFILE_DIR; |
| | | unacceptableReasons.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "hasAcceptableConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_PLUGIN_PROFILER_CANNOT_DETERMINE_AUTOSTART; |
| | | unacceptableReasons.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "hasAcceptableConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_PLUGIN_PROFILER_CANNOT_DETERMINE_ACTION; |
| | | unacceptableReasons.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | public final ConfigChangeResult applyNewConfiguration(ConfigEntry configEntry, |
| | | boolean detailedResults) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "applyNewConfiguration", |
| | | String.valueOf(configEntry), |
| | | String.valueOf(detailedResults)); |
| | | |
| | | |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyNewConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_PLUGIN_PROFILER_CANNOT_UPDATE_INTERVAL; |
| | | messages.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyNewConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_PLUGIN_PROFILER_CANNOT_UPDATE_DIRECTORY; |
| | | messages.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyNewConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_PLUGIN_PROFILER_CANNOT_WRITE_PROFILE_DATA; |
| | | messages.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializePlugin", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_PLUGIN_PROFILER_CANNOT_PERFORM_ACTION; |
| | | messages.add(getMessage(msgID, String.valueOf(configEntryDN), |