wt.cache
Class MasterCacheMonitor

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended bywt.util.RMIServer
              extended bywt.cache.CacheManager
                  extended bywt.cache.MasterCacheMonitor
All Implemented Interfaces:
CacheServer, Remote, Runnable, Serializable, Unreferenced

public class MasterCacheMonitor
extends CacheManager
implements Runnable

Special cache manager used to implement remote master monitoring. This class periodically pings the master cache. It it is ever reset as a result of connecting to a new master, all registered caches will also be reset so they will register with the new master in a timely fashion.

Should be a static public inner class of CacheManager, but JDK compiler barfs on blank final initializers when CacheManager class contains inner classes.

Supported API: false

See Also:
Serialized Form

Field Summary
private static Vector cacheManagers
           
private static MasterCacheMonitor monitor
           
 
Fields inherited from class wt.cache.CacheManager
id, MARSHAL_RETRY, MASTER, MASTER_MONITOR_INTERVAL, name, OTHER_RETRY, slaves, VERBOSE_SERVER
 
Fields inherited from class wt.util.RMIServer
csf, ssf
 
Fields inherited from class java.rmi.server.RemoteServer
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface wt.cache.CacheServer
versionID
 
Constructor Summary
MasterCacheMonitor()
           
 
Method Summary
 int getDefaultSize()
          Get desired size of this cache.
static MasterCacheMonitor getInstance()
           
(package private)  void registerCacheManager(CacheManager manager)
           
 void reset()
          Reset local cache after master reconnect.
 void run()
           
 
Methods inherited from class wt.cache.CacheManager
checkAccess, get, getDefaultName, getEntry, isCacheHost, overflow, ping, put, putEntry, putEntry, reference, registerSlave, remove, remove, removeEntry, removeEntry, unreferenced, update, updateEntry, updateEntry
 
Methods inherited from class wt.util.RMIServer
clone, exportObject, exportObject, exportObject, getClientSocketFactory, getPort, getServerSocketFactory, getStub, isHostInList, isLocalHost, setPort, writeReplace
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

monitor

private static MasterCacheMonitor monitor

cacheManagers

private static Vector cacheManagers
Constructor Detail

MasterCacheMonitor

public MasterCacheMonitor()
                   throws RemoteException
Method Detail

getInstance

public static MasterCacheMonitor getInstance()
                                      throws RemoteException
Throws:
RemoteException

registerCacheManager

void registerCacheManager(CacheManager manager)
                    throws RemoteException
Throws:
RemoteException

getDefaultSize

public int getDefaultSize()
Description copied from class: CacheManager
Get desired size of this cache. This method attemps to find a size property called wt.cache.size.CacheName where cacheName is the name of this cache. Subclasses can override this method to control cache size in some other way. If no property is found, the default size is 100.

Supported API: true

Overrides:
getDefaultSize in class CacheManager

run

public void run()
Specified by:
run in interface Runnable

reset

public void reset()
           throws RemoteException
Description copied from class: CacheManager
Reset local cache after master reconnect. Called after recovery from communication failure when a connection to a new master has been established. The current cache contents are cleared and the local cache is registered as a slave of the new master.

NOTE: This may be called as a result of calling other cache updating operations since that is when the disconnect and reconnect may take place. When this happens, this method is called before the other methods return.

Supported API: true

Overrides:
reset in class CacheManager
Throws:
RemoteException