org.apache.jcs.auxiliary.remote
Class RemoteCacheMonitor

java.lang.Object
  extended byorg.apache.jcs.auxiliary.remote.RemoteCacheMonitor
All Implemented Interfaces:
java.lang.Runnable

public class RemoteCacheMonitor
extends java.lang.Object
implements java.lang.Runnable

Used to monitor and repair any failed connection for the remote cache service. By default the monitor operates in a failure driven mode. That is, it goes into a wait state until there is an error. TODO consider moving this into an active monitoring mode. Upon the notification of a connection error, the monitor changes to operate in a time driven mode. That is, it attempts to recover the connections on a periodic basis. When all failed connections are restored, it changes back to the failure driven mode.

Author:
asmuts

Field Summary
private  boolean alright
           
(package private) static int ERROR
           
private static long idlePeriod
           
private static RemoteCacheMonitor instance
           
private static org.apache.commons.logging.Log log
           
(package private) static int mode
           
(package private) static int TIME
           
 
Constructor Summary
private RemoteCacheMonitor()
          Constructor for the RemoteCacheMonitor object
 
Method Summary
private  void bad()
          Sets the "alright" flag to false in a critial section.
(package private) static RemoteCacheMonitor getInstance()
          Returns the singleton instance;
 void notifyError()
          Notifies the cache monitor that an error occurred, and kicks off the error recovery process.
 void run()
          Main processing method for the RemoteCacheMonitor object
static void setIdlePeriod(long idlePeriod)
          Configures the idle period between repairs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

instance

private static RemoteCacheMonitor instance

idlePeriod

private static long idlePeriod

alright

private boolean alright

TIME

static final int TIME
See Also:
Constant Field Values

ERROR

static final int ERROR
See Also:
Constant Field Values

mode

static int mode
Constructor Detail

RemoteCacheMonitor

private RemoteCacheMonitor()
Constructor for the RemoteCacheMonitor object

Method Detail

setIdlePeriod

public static void setIdlePeriod(long idlePeriod)
Configures the idle period between repairs.

Parameters:
idlePeriod - The new idlePeriod value

getInstance

static RemoteCacheMonitor getInstance()
Returns the singleton instance;

Returns:
The instance value

notifyError

public void notifyError()
Notifies the cache monitor that an error occurred, and kicks off the error recovery process.


run

public void run()
Main processing method for the RemoteCacheMonitor object

Specified by:
run in interface java.lang.Runnable

bad

private void bad()
Sets the "alright" flag to false in a critial section.