com.sun.slamd.server
Class LoggerThread

java.lang.Object
  extended byjava.lang.Thread
      extended bycom.sun.slamd.server.LoggerThread
All Implemented Interfaces:
ConfigSubscriber, java.lang.Runnable

public class LoggerThread
extends java.lang.Thread
implements ConfigSubscriber

This class implements a thread that can be used to asynchronously write information to a specified log file. It works in conjunction with the SLAMD logger so that when the SLAMD logger is configured to work asynchronously it will write any messages to be logged into a memory-based queue. The logger thread will then periodically poll that queue to see if there are any messages to be logged. If so, then those messages will be written into the log file and the queue emptied. In this manner, the overhead associated with logging will not adversely impact the performance of the SLAMD server. Note that there will not be any debug logging performed in this class in order to prevent logging loops. However, significant events will be written to standard error.


Field Summary
static java.lang.String CONFIG_SUBSCRIBER_NAME
          The name used to register the logger as a subscriber to the configuration handler.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
LoggerThread(SLAMDServer slamdServer, Logger logger)
          Creates the logging thread and retrieves any pertinent configuration information from the configuration handler.
 
Method Summary
 java.lang.String getSubscriberName()
          Retrieves the name that the logger thread uses to subscribe to the configuration handler in order to be notified of configuration changes.
 ParameterList getSubscriberParameters()
          Retrieves the set of configuration parameters associated with this configuration subscriber.
 void refreshSubscriberConfiguration()
          Re-reads all configuration information used by the logger thread.
 void refreshSubscriberConfiguration(java.lang.String parameterName)
          Re-reads all configuration information used by the logger thread.
 void run()
          Performs the work of actually polling the logger's queue and writing any information that it finds there into the log file.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONFIG_SUBSCRIBER_NAME

public static final java.lang.String CONFIG_SUBSCRIBER_NAME
The name used to register the logger as a subscriber to the configuration handler.

See Also:
Constant Field Values
Constructor Detail

LoggerThread

public LoggerThread(SLAMDServer slamdServer,
                    Logger logger)
Creates the logging thread and retrieves any pertinent configuration information from the configuration handler.

Parameters:
slamdServer - The SLAMD server with which this logging thread will be associated.
logger - The SLAMD logger whose queue this logging thread will watch.
Method Detail

run

public void run()
Performs the work of actually polling the logger's queue and writing any information that it finds there into the log file. Any problems encountered in this process will be written to standard error.

Specified by:
run in interface java.lang.Runnable

getSubscriberName

public java.lang.String getSubscriberName()
Retrieves the name that the logger thread uses to subscribe to the configuration handler in order to be notified of configuration changes.

Specified by:
getSubscriberName in interface ConfigSubscriber
Returns:
The name that the logger thread uses to subscribe to the configuration handler in order to be notified of configuration changes.

getSubscriberParameters

public ParameterList getSubscriberParameters()
Retrieves the set of configuration parameters associated with this configuration subscriber.

Specified by:
getSubscriberParameters in interface ConfigSubscriber
Returns:
The set of configuration parameters associated with this configuration subscriber.

refreshSubscriberConfiguration

public void refreshSubscriberConfiguration()
Re-reads all configuration information used by the logger thread. In this case, the only option is the delay to use between polls of the log buffer.

Specified by:
refreshSubscriberConfiguration in interface ConfigSubscriber

refreshSubscriberConfiguration

public void refreshSubscriberConfiguration(java.lang.String parameterName)
Re-reads all configuration information used by the logger thread. In this case, the only option is the delay to use between polls of the log buffer.

Specified by:
refreshSubscriberConfiguration in interface ConfigSubscriber
Parameters:
parameterName - The name of the parameter to be re-read from the configuration.