org.apache.jcs.auxiliary.remote
Class RemoteCacheFailoverRunner

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

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

The RemoteCacheFailoverRunner tries to establish a connection with a failover server, if any are defined. Once a failover connectin is made, it will attempt to replace the failover with the primary remote server.

It works by switching out the RemoteCacheNoWait inside the Facade.

Client (i.e.) the CompositeCache has refernce to a RemoteCacheNoWaitFacade. This facade is created by the RemoteCacheFactory. The factory maintains a set of managers, one for each remote server. Typically, there will only be one manager.

If you use multipleremote servesr, you may want to set one or more as failovers. If a local cache cannot connect to the primary server, or looses its connection to the primary server, it will attempt to restore that connectin in the background. If failovers are defined, the Failover runner will try to connect to a failover until the primary is restored.


Constructor Summary
RemoteCacheFailoverRunner(RemoteCacheNoWaitFacade facade)
          Constructor for the RemoteCacheFailoverRunner object.
 
Method Summary
 void notifyError()
          Notifies the cache monitor that an error occurred, and kicks off the error recovery process.
 void run()
          Main processing method for the RemoteCacheFailoverRunner object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteCacheFailoverRunner

public RemoteCacheFailoverRunner(RemoteCacheNoWaitFacade facade)
Constructor for the RemoteCacheFailoverRunner object. This allows the FailoverRunner to modify the facade that the CompositeCache references.

Method Detail

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 RemoteCacheFailoverRunner object.

If we do not have a connection with any failover server, this will try to connect one at a time. If no connection can be made, it goes to sleep for a while (20 seconds).

Once a connection with a failover is made, we will try to reconnect to the primary server.

The primary server is the first server defines in the FailoverServers list.

Specified by:
run in interface java.lang.Runnable


Copyright © 2002-2005 Apache Software Foundation. All Rights Reserved.