com.ibm.wsspi.timedoperations

Class TimedOperationService

  • java.lang.Object
    • com.ibm.wsspi.timedoperations.TimedOperationService


  • public class TimedOperationService
    extends java.lang.Object

    The TimedOperationService controls the enablement of all timed operations and manages the TimedOperation instances.

    The TimedOperationService is disabled by default and is enabled when the "timedOperations-1.0" <feature> element is added into the server.xml file.

    For example, you can add the following configuration snippet to enable the TimedOperationService:
    <server>
     
         <featureManager>
              <feature>timedOperations-1.0</feature>
         </featureManager>
     
     </server>  
    To disable the TimedOperationService, remove the "timedOperations-1.0" <feature> element from server.xml.

    Since features can be added to and removed from the server configuration without server restarts, the use of the TimedOperationService is supported only in the following scenario in order to make sure that your bundle resolution does not fail because of an unresolved import when the timedOperations-1.0 feature is not configured.

    Your bundle provides the timed operations monitoring only when the timedOperations-1.0 is also enabled. Therefore you need to separate the code that provides the timed operations function into its own feature, and declare it to be an 'auto feature', which means that users don't directly configure it in their server.xml but it will be added by the feature manager if both your feature and the timedOperations-1.0 feature are configured. This way you ensure that all the required packages will be available in the framework.

    Note that when the TimedOperationService is disabled all TimedOperation state objects will be erased.

    • Method Summary

      Methods 
      Modifier and Type Method and Description
      static int getMaxNumberTimedOperations()
      Returns the configured maximum number of timed operations that the system allows.
      static int getReportFrequency()
      Indicates how often the report to the logs detailing the ten longest timed operations is generated.
      static TimedOperation getTimedOperation(java.lang.String type, java.lang.String pattern)
      Returns a TimedOperation configured for the specified type and pattern.
      static java.util.Collection<TimedOperation> getTimedOperations()
      Lists all known timed operations.
      static java.util.HashMap<java.lang.String,java.util.ArrayList<TimedOperation>> getTimedOperationsByType()
      Lists all known timed operations, grouped by type.
      static boolean isEnabled()
      Indicates whether or not the TimedOperationService is enabled.
      static boolean isReportEnabled()
      Indicates if a report to the logs, which details the ten longest timed operations, grouped by type, and sorted within each group by expected duration, is periodically generated or not.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TimedOperationService

        public TimedOperationService()
    • Method Detail

      • isEnabled

        public static boolean isEnabled()
        Indicates whether or not the TimedOperationService is enabled. When the TimedOperationService is enabled, all TimedOperations are enabled. When the TimedOperationService is disabled, all TimedOperations are disabled.
      • getMaxNumberTimedOperations

        public static int getMaxNumberTimedOperations()
        Returns the configured maximum number of timed operations that the system allows. When the maximum number is reached, new timed operations will not be created until some of the existing ones are removed once they not in used anymore.
        Returns:
        the configured maximum number of timed operations.
      • isReportEnabled

        public static boolean isReportEnabled()
        Indicates if a report to the logs, which details the ten longest timed operations, grouped by type, and sorted within each group by expected duration, is periodically generated or not.
        Returns:
        true if generating a report is enabled and false otherwise.
        See Also:
        getReportFrequency()
      • getReportFrequency

        public static int getReportFrequency()
        Indicates how often the report to the logs detailing the ten longest timed operations is generated.
        Returns:
        frequency of generating report in hours.
        See Also:
        isReportEnabled()
      • getTimedOperation

        public static TimedOperation getTimedOperation(java.lang.String type,
                                       java.lang.String pattern)
        Returns a TimedOperation configured for the specified type and pattern.
        Parameters:
        type - the type of the timed operation.
        pattern - optional pattern of the timed operation, which specifies a particular instance name to indicate the specific operation being performed.
        Returns:
        the TimedOperation identified by the type and pattern.
      • getTimedOperations

        public static java.util.Collection<TimedOperation> getTimedOperations()
        Lists all known timed operations.
        Returns:
        all known TimedOperations.
      • getTimedOperationsByType

        public static java.util.HashMap<java.lang.String,java.util.ArrayList<TimedOperation>> getTimedOperationsByType()
        Lists all known timed operations, grouped by type.
        Returns:
        all known TimedOperations.