com.bowstreet.appserver
Class ServerStats

java.lang.Object
  extended by com.bowstreet.appserver.ServerStats

public class ServerStats
extends java.lang.Object

ServerStats This class is used to log server events to a file, in Server Statistics files. It can track counts (how many times something was done) and average elapsed times. File writing is controlled by the logging.properties file settings. User-defined events can be added using addServerStatsEvent.


Field Summary
static int STAT_ActiveSessions
           
static int STAT_EngineRequests
           
static int STAT_ErrorsLogged
           
static int STAT_MemFree
           
static int STAT_MemInUse
           
static int STAT_MemTotal
           
static int STAT_MethodCacheEntries
           
static int STAT_ModelCacheEntries
           
static int STAT_ModelCacheRegenEntries
           
static int STAT_ModelsInSessions
           
static int STAT_ModelsInstantiated
           
static int STAT_ModelXmlCacheEntries
           
static int STAT_OutputCacheHits
           
static int STAT_OutputCacheMisses
           
static int STAT_ParallelModelRequests
           
static int STAT_PeakSessions
           
static int STAT_ProfileCacheHits
           
static int STAT_ProfileCacheMisses
           
static int STAT_ProfileSetCacheHits
           
static int STAT_ProfileSetCacheMisses
           
static int STAT_Regens
           
static int STAT_RegensFromCache
           
static int STAT_RestoredSessions
           
static int STAT_SchemaCacheEntries
           
static int STAT_SchemaCacheHits
           
static int STAT_SchemaCacheMisses
           
static int STAT_Sessions
           
static int STAT_SevereErrorsLogged
           
static int STAT_WarningsLogged
           
static int STAT_WebAppJSPSourceWritten
           
static int STAT_WebAppMethodClassWritten
           
static int STAT_WebAppRequests
           
static int STAT_WebAppsInSessions
           
static int STAT_WebAppsInstantiated
           
static int STAT_WebAppSOAPRequests
           
static int statCount
           
 
Constructor Summary
ServerStats()
           
 
Method Summary
static int addServerStatsEvent(java.lang.String name)
          Register an event type.
static long getCount(int eventType)
          Get the current event count for the specified event type.
static java.util.Map getCurrentStats(boolean resetCounters)
          Gets a hash map of the top-level entries in current (in-memory) statistics.
static int getKeyIntValue(java.lang.String key)
          Gets the int value corresponding to an event name.
static java.lang.String getName(int index)
          Gets the name corresponding to an event index.
static com.bowstreet.appserver.logmanager.ServerStatsLog getServerStatsLog(boolean resetCounters)
          Gets all the current values in format suitable for writing to file.
static java.lang.String[] getStatsAttributes()
           
static boolean isRunModelOnly(int index)
          See if an entry is obsolete RunModel
static void logEvent(int eventType)
          Increment the counter for an event.
static void logTimedEvent(int eventType, long elapsed)
          Log a single action, with its elapsed clock time.
static void logTimedEvent(int eventType, long elapsed, java.lang.String name, java.lang.String childName)
          Log action, with name, sub-name and an elapsed time.
static void setEntry(int eventType, long value)
          Set the count of an event type to a specific value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STAT_ActiveSessions

public static final int STAT_ActiveSessions
See Also:
Constant Field Values

STAT_EngineRequests

public static final int STAT_EngineRequests
See Also:
Constant Field Values

STAT_ErrorsLogged

public static final int STAT_ErrorsLogged
See Also:
Constant Field Values

STAT_MemFree

public static final int STAT_MemFree
See Also:
Constant Field Values

STAT_MemInUse

public static final int STAT_MemInUse
See Also:
Constant Field Values

STAT_MemTotal

public static final int STAT_MemTotal
See Also:
Constant Field Values

STAT_MethodCacheEntries

public static final int STAT_MethodCacheEntries
See Also:
Constant Field Values

STAT_ModelCacheEntries

public static final int STAT_ModelCacheEntries
See Also:
Constant Field Values

STAT_ModelCacheRegenEntries

public static final int STAT_ModelCacheRegenEntries
See Also:
Constant Field Values

STAT_ModelsInSessions

public static final int STAT_ModelsInSessions
See Also:
Constant Field Values

STAT_ModelsInstantiated

public static final int STAT_ModelsInstantiated
See Also:
Constant Field Values

STAT_ModelXmlCacheEntries

public static final int STAT_ModelXmlCacheEntries
See Also:
Constant Field Values

STAT_OutputCacheHits

public static final int STAT_OutputCacheHits
See Also:
Constant Field Values

STAT_OutputCacheMisses

public static final int STAT_OutputCacheMisses
See Also:
Constant Field Values

STAT_ParallelModelRequests

public static final int STAT_ParallelModelRequests
See Also:
Constant Field Values

STAT_PeakSessions

public static final int STAT_PeakSessions
See Also:
Constant Field Values

STAT_ProfileCacheHits

public static final int STAT_ProfileCacheHits
See Also:
Constant Field Values

STAT_ProfileCacheMisses

public static final int STAT_ProfileCacheMisses
See Also:
Constant Field Values

STAT_ProfileSetCacheHits

public static final int STAT_ProfileSetCacheHits
See Also:
Constant Field Values

STAT_ProfileSetCacheMisses

public static final int STAT_ProfileSetCacheMisses
See Also:
Constant Field Values

STAT_Regens

public static final int STAT_Regens
See Also:
Constant Field Values

STAT_RegensFromCache

public static final int STAT_RegensFromCache
See Also:
Constant Field Values

STAT_RestoredSessions

public static final int STAT_RestoredSessions
See Also:
Constant Field Values

STAT_SchemaCacheEntries

public static final int STAT_SchemaCacheEntries
See Also:
Constant Field Values

STAT_SchemaCacheHits

public static final int STAT_SchemaCacheHits
See Also:
Constant Field Values

STAT_SchemaCacheMisses

public static final int STAT_SchemaCacheMisses
See Also:
Constant Field Values

STAT_Sessions

public static final int STAT_Sessions
See Also:
Constant Field Values

STAT_SevereErrorsLogged

public static final int STAT_SevereErrorsLogged
See Also:
Constant Field Values

STAT_WarningsLogged

public static final int STAT_WarningsLogged
See Also:
Constant Field Values

STAT_WebAppJSPSourceWritten

public static final int STAT_WebAppJSPSourceWritten
See Also:
Constant Field Values

STAT_WebAppMethodClassWritten

public static final int STAT_WebAppMethodClassWritten
See Also:
Constant Field Values

STAT_WebAppRequests

public static final int STAT_WebAppRequests
See Also:
Constant Field Values

STAT_WebAppsInSessions

public static final int STAT_WebAppsInSessions
See Also:
Constant Field Values

STAT_WebAppsInstantiated

public static final int STAT_WebAppsInstantiated
See Also:
Constant Field Values

STAT_WebAppSOAPRequests

public static final int STAT_WebAppSOAPRequests
See Also:
Constant Field Values

statCount

public static int statCount
Constructor Detail

ServerStats

public ServerStats()
Method Detail

addServerStatsEvent

public static int addServerStatsEvent(java.lang.String name)
Register an event type. Use the returned int for subsequent calls to the "log" methods. The returned int will always be greater than zero.

Parameters:
name - The name that you want to appear in the server stats file.
Returns:
The index which is used in subsequent calls to logEvent and logTimedEvent.

getCount

public static long getCount(int eventType)
Get the current event count for the specified event type.

Parameters:
eventType - The index of the event
Returns:
count for the specified event

getCurrentStats

public static java.util.Map getCurrentStats(boolean resetCounters)
Gets a hash map of the top-level entries in current (in-memory) statistics. For internal Factory use only.


getKeyIntValue

public static int getKeyIntValue(java.lang.String key)
Gets the int value corresponding to an event name.

Parameters:
key - The name as shown in the server stats file.
Returns:
The integer value for this event (for use in logEvent).

getName

public static java.lang.String getName(int index)
Gets the name corresponding to an event index.

Parameters:
index - The integer index for an event.
Returns:
The name as shown in the server stats file.

getServerStatsLog

public static com.bowstreet.appserver.logmanager.ServerStatsLog getServerStatsLog(boolean resetCounters)
Gets all the current values in format suitable for writing to file. For internal Factory use only.


getStatsAttributes

public static java.lang.String[] getStatsAttributes()

isRunModelOnly

public static boolean isRunModelOnly(int index)
See if an entry is obsolete RunModel


logEvent

public static void logEvent(int eventType)
Increment the counter for an event.

Parameters:
eventType - The index of the event. This can be a predefined event or a user-defined event returned from addServerStatsEvent.
Example:
logEvent(ServerStats.STAT_Regens);

logTimedEvent

public static void logTimedEvent(int eventType,
                                 long elapsed)
Log a single action, with its elapsed clock time.

Parameters:
eventType - The index of the event. This can be a predefined event or a user-defined event returned from addServerStatsEvent.
elapsed - The time for this event.

logTimedEvent

public static void logTimedEvent(int eventType,
                                 long elapsed,
                                 java.lang.String name,
                                 java.lang.String childName)
Log action, with name, sub-name and an elapsed time. See server stats doc for how this is used for model requests, for example.

Parameters:
eventType - The index of the event. This can be a predefined event or a user-defined event returned from addServerStatsEvent.
Example:
ServerStats.logTimedEvent(ServerStats.STAT_ModelRequest, elapsed, modelID, pageID);

setEntry

public static void setEntry(int eventType,
                            long value)
Set the count of an event type to a specific value.

Parameters:
eventType - The index of the event.
value - the value that this event entry be set to.


Copyright © 2009 IBM. All Rights Reserved.