wt.method
Class ClusterMonitor

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

public class ClusterMonitor
extends CacheManager
implements RemoteAccess

ClusterMonitor extends CacheManager to maintain a collection of live references to other ClusterMonitor objects in the cluster. An instance of ClusterMonitor is created at method server startup using the wt.method.loadObject mechanism. At startup, each instance of ClusterMonitor adds itself to its master's cache. In this way, all instances of ClusterMonitor and thus all MethodServers, and ServerManagers become known to the Cache Master. The cache of ClusterMonitors can be queried to return a Vector of live references to all ClusterMonitors. (Dead references are removed prior to return) All MethodServerInfo and ServerManagerInfo objects in the cluster can be collected with a single method call for performance monitoring. This provides a mechanism for displaying cluster state and performance metrics. Loaded by MethodServerMain via property wt.method.loadObjects

See Also:
Serialized Form

Field Summary
static String ALL_SERVERS_KEY
           
private static Cache cache
           
private static int CACHE_SIZE
           
private static ClusterMonitor clusterMonitor
           
static String SERVER_INFO_KEY
           
private static boolean VERBOSE
           
 
Fields inherited from class wt.cache.CacheManager
MASTER
 
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.method.RemoteAccess
versionID
 
Fields inherited from interface wt.cache.CacheServer
versionID
 
Constructor Summary
ClusterMonitor()
           
 
Method Summary
static HashMap getAllInfos()
           
static Vector getAllServers()
           
static RemoteStub getClusterMonitorStub()
          Return the RemoteStub to this ClusterMonitor
 int getDefaultSize()
          Get desired size of this cache.
 Object getEntry(Object key)
          Override CacheManager's getEntry When key is of CacheServer return that server's MethodServerInfo or ServerManagerInfo object When key is ALL_SERVERS_KEY request Vector from the Master Cache
 Object getInfo()
           
private static boolean isAlive(RemoteStub stub)
           
static void main(String[] args)
           
 void ping()
          Remote method for verifying ccess.
 void putEntry(Object key, Object value)
          Override CacheManager's putEntry
static RemoteStub Registrar(Boolean register_flag)
          Allow a remote client to register/unregister this ClusterMonitor from the CacheManager.
 void removeEntry(Object key)
          Protected method which allows subclasses of CacheManager to take some action when a entry is being removed from the local cache.
 void reset()
          Method called when connection to master cache is broken and recovered indicating that a notification from another project cache might have been missed.
 
Methods inherited from class wt.cache.CacheManager
checkAccess, get, getDefaultName, isCacheHost, overflow, put, putEntry, reference, registerSlave, remove, remove, 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

clusterMonitor

private static ClusterMonitor clusterMonitor

VERBOSE

private static final boolean VERBOSE

cache

private static Cache cache

ALL_SERVERS_KEY

public static final String ALL_SERVERS_KEY
See Also:
Constant Field Values

SERVER_INFO_KEY

public static final String SERVER_INFO_KEY
See Also:
Constant Field Values

CACHE_SIZE

private static final int CACHE_SIZE
Constructor Detail

ClusterMonitor

public ClusterMonitor()
               throws RemoteException
Method Detail

putEntry

public void putEntry(Object key,
                     Object value)
Override CacheManager's putEntry

Overrides:
putEntry in class CacheManager
Parameters:
key - the key object
value - the value object

getEntry

public Object getEntry(Object key)
Override CacheManager's getEntry When key is of CacheServer return that server's MethodServerInfo or ServerManagerInfo object When key is ALL_SERVERS_KEY request Vector from the Master Cache

Specified by:
getEntry in interface CacheServer
Overrides:
getEntry in class CacheManager

removeEntry

public void removeEntry(Object key)
Description copied from class: CacheManager
Protected method which allows subclasses of CacheManager to take some action when a entry is being removed from the local cache. This method is invoked to remove the entry in the local cache as a result of a local remove call or a call forwarded from a master cache. If this cache has a master cache, the remove call will already be forwarded to the master before this method is invoked. Slave caches will be notified to remove their entries after this method returns. This method must not cause a recursive remove call.

This method is not called when entries are being removed by the overflow or reset methods.

Supported API: true

Overrides:
removeEntry in class CacheManager
Parameters:
key - the key object (null = clear entire cache)

reset

public void reset()
           throws RemoteException
Method called when connection to master cache is broken and recovered indicating that a notification from another project cache might have been missed. The local cache is cleared and the ClusterMontor is re-registered.

Overrides:
reset in class CacheManager
Throws:
RemoteException

ping

public void ping()
Description copied from class: CacheManager
Remote method for verifying ccess.

Supported API: false

Specified by:
ping in interface CacheServer
Overrides:
ping in class CacheManager

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

getInfo

public Object getInfo()

isAlive

private static boolean isAlive(RemoteStub stub)

getAllInfos

public static HashMap getAllInfos()

getAllServers

public static Vector getAllServers()

getClusterMonitorStub

public static RemoteStub getClusterMonitorStub()
Return the RemoteStub to this ClusterMonitor


Registrar

public static RemoteStub Registrar(Boolean register_flag)
Allow a remote client to register/unregister this ClusterMonitor from the CacheManager. Provides a mechanism to test & verify Cache configuration


main

public static void main(String[] args)