wt.method
Class ClusterMonitor
java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
wt.util.RMIServer
wt.cache.CacheManager
wt.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
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 |
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
ClusterMonitor
public ClusterMonitor()
throws RemoteException
putEntry
public void putEntry(Object key,
Object value)
- Override CacheManager's putEntry
- Overrides:
putEntry
in class CacheManager
- Parameters:
key
- the key objectvalue
- 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)