public class Vwm extends Object implements VwmInterface, VwmProbeInterface, Runnable
| Modifier and Type | Field and Description |
|---|---|
(package private) Vector<VwmCallBackInterface> |
clients
What clients are using this VWM.
|
(package private) Thread |
kicker
Thread in which the VWM runs.
|
protected String |
name
Name of the VWM.
|
protected VwmProbe |
probe
Scheduler of tasks depending on VWMtask nodes associated with this Vwm.
|
protected int |
sleeptime
Sleep time in seconds.
|
protected Vwms |
Vwms
The VWMs builder that holds the VWM's node.
|
protected MMObjectNode |
wvmnode
The creation node of this VWM.
|
| Constructor and Description |
|---|
Vwm() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addClient(VwmCallBackInterface client)
Add a client to the listen queue of the wvm.
|
protected boolean |
claim(MMObjectNode node)
Signals that the task node is claimed.
|
protected void |
debug(String msg) |
protected boolean |
failed(MMObjectNode node)
Signals that the task to be performed failed.
|
String |
getName()
Returns the name of the VWM.
|
MMObjectNode |
getVwmNode()
Retrieves the creation node of this VWM.
|
void |
init(MMObjectNode vwmnode,
Vwms Vwms)
Initialize the Vwm.
|
boolean |
nodeLocalChanged(String machine,
String number,
String builder,
String ctype)
Called when a remote node is changed.
|
boolean |
nodeRemoteChanged(String machine,
String number,
String builder,
String ctype)
Called when a local node is changed.
|
protected Hashtable |
parseProperties(String props)
Converts a string of properties to a Hashtable.
|
protected boolean |
performed(MMObjectNode node)
Signals that the task to be performed was successful and has finished.
|
boolean |
performTask(MMObjectNode node)
Performs maintenance based on a Vwmtasknode.
|
boolean |
probeCall()
Performs periodic maintenance.
|
boolean |
putTask(MMObjectNode node)
Adds a new task to the list of taks to perform.
|
boolean |
releaseClient(VwmCallBackInterface client)
Release a client from the listen queue of the wvm.
|
protected boolean |
rollback(MMObjectNode node)
Signals that the task should be performed again (possibly after an initial failure).
|
void |
run()
VWM maintenance scheduler.
|
void |
start()
Starts the thread for the Vwm.
|
void |
stop()
Stops the Vwm's thread.
|
protected VwmProbe probe
protected int sleeptime
protected MMObjectNode wvmnode
protected String name
protected Vwms Vwms
parent attribute of the vwm node (but a bit easier in use).getVwmNode()Thread kicker
run() method.Vector<VwmCallBackInterface> clients
VwmCallBackInterface, and can be invoked when important changes occur.protected void debug(String msg)
public void init(MMObjectNode vwmnode, Vwms Vwms)
init in interface VwmInterfacevwmnode - Vwms - The VWMs builder. It is not really necessary as this is the same as the parent attribute of vwmnode.public void start()
public void stop()
public void run()
probeCall() method, after which the thread sleeps for a number of seconds as set in sleeptime.public boolean addClient(VwmCallBackInterface client)
addClient in interface VwmInterfaceclient - The client-object to addtrue if the client was added, false if it already existed in the queue.public boolean releaseClient(VwmCallBackInterface client)
releaseClient in interface VwmInterfaceclient - The client-object to releasetrue if the client was released, false if it did not exist in the queue.public boolean probeCall()
run() method.
Since this does not actually do anything, perhaps this method should be abstract.probeCall in interface VwmProbeInterfacetrue if maintenance was performed, false otherwisepublic boolean putTask(MMObjectNode node)
node - the node describing the task (from the Vwmtasks builder)true is the task was succesfully added.public String getName()
getName in interface VwmProbeInterfacepublic boolean performTask(MMObjectNode node)
probe object assoviated with the VWM.
the default method sets a status field to indicate an error, and sends an error email.
Perhaps this method should be abstract.performTask in interface VwmProbeInterfacenode - The Vwmtask node that describes the task to be performed.true if maintenance was performed, false if it failedprotected boolean claim(MMObjectNode node)
node - The VwmTask node that describes the tasktrue if teh task's state was cahnged, false if it fails.protected boolean rollback(MMObjectNode node)
node - The VwmTask node that describes the tasktrue if teh task's state was cahnged, false if it fails.protected boolean failed(MMObjectNode node)
node - The VwmTask node that describes the tasktrue if the task's state was cahnged, false if it fails.protected boolean performed(MMObjectNode node)
node - The VwmTask node that describes the tasktrue if teh task's state was cahnged, false if it fails.protected Hashtable parseProperties(String props)
props - the properties stringhashtable with the property name=value pairs.public MMObjectNode getVwmNode()
public boolean nodeRemoteChanged(String machine, String number, String builder, String ctype)
nodeRemoteChanged in interface MMBaseObservermachine - Name of the machine that changed the node.number - Number of the changed node as a Stringbuilder - type of the changed nodectype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=newtrue if maintenance was performed, false (the default) otherwisepublic boolean nodeLocalChanged(String machine, String number, String builder, String ctype)
nodeLocalChanged in interface MMBaseObservermachine - Name of the machine that changed the node.number - Number of the changed node as a Stringbuilder - type of the changed nodectype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=newtrue if maintenance was performed, false (the default) otherwiseMMBase 1.9-SNAPSHOT - ${javadoctimestamp}