|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.computing.distributed.server.MultiServerDaemon
public class MultiServerDaemon
MultiServerDaemon allocates multiple clients between multiple servers in real-time. An XML configuration file is regularly checked for changes to the allocation scheme. All clients connect to the same RMI server (same host, port and binding name) which is this MultiServerDaemon. MultiServerDaemon then decides which server to allocate each client to. Control over which client gets allocated to what server is defined in an XML file. This file also defines the classes for the internal servers to load and with what parameters. The current implementation allows the following allocation policies to be defined in the configuration file:
<?xml version='1.0' encoding='utf-8'?>
<MSCFG>
<server>
<class>package.name.ClassName</class>
<args>arg0 arg1 passed ClassName constructor in ArrayList</args>
<name>MyFirstServer</name>
<client>Cruncher</client>
</server>
<server>
<class>other.package.name.OtherClassName</class>
<args>more args</args>
<name>MySecondServer</name>
</server>
<server>
<class>jaga.pj.circuits.control.EvoRepair</class>
<args>/home/username/log/ server0.txt C17 C All TP 5 0 1</args>
<name>evoRep</name>
<client>BANK</client>
</server>
<server>
<class>jaga.pj.circuits.control.EvoBIST</class>
<args>/home/mmg20/log/test/ evob.txt nologging</args>
<name>evoBIST</name>
</server>
</MSCFG>
This XML file defines two servers with specific clients and two public
servers. All clients with name Cruncher and BANK will be allocated to
servers MyFirstServer and evoRep respectively. All other clients will be
shared between MySecondServer and evoBIST.
| Field Summary | |
|---|---|
protected java.util.ArrayList |
clientRecords
DOCUMENT ME! |
protected java.util.HashSet |
clientsToDisconnect
DOCUMENT ME! |
protected java.lang.String |
configFileName
DOCUMENT ME! |
protected java.lang.Thread |
configRefreshDaemon
DOCUMENT ME! |
protected int |
currGeneratedID
DOCUMENT ME! |
protected java.util.Hashtable |
nameServer
DOCUMENT ME! |
static int |
REFRESH_SECONDS
Number of seconds to wait between re-reading configuration file. |
protected java.util.HashSet |
serverPool
DOCUMENT ME! |
protected java.util.Iterator |
serverPoolI
DOCUMENT ME! |
| Constructor Summary | |
|---|---|
MultiServerDaemon(java.util.ArrayList args)
Creates a new instance of MultiServerStage2 |
|
| Method Summary | |
|---|---|
protected void |
addToDisconnectList(java.lang.String clientName)
DOCUMENT ME! |
protected void |
checkAndDisconnectClient(java.lang.Object id)
DOCUMENT ME! |
protected java.util.HashSet |
clientRecordsForName(java.lang.String clientName)
DOCUMENT ME! |
protected void |
disconnectClient()
DOCUMENT ME! |
protected ServerRecord |
findSpecificServer(java.lang.String clientName)
DOCUMENT ME! |
java.lang.Object |
getID(java.lang.Object initialParameters)
Called by clients the first time they connect. |
InteractiveTask |
getTask(java.lang.Object id)
This will provide the client with the InteractiveTask it should run. |
java.lang.Object |
interact(java.lang.Object id,
java.lang.Object clientTaskOutput)
Called by clients when they wish to interact. |
protected void |
println(java.lang.String text)
DOCUMENT ME! |
protected void |
readXMLConfig(java.lang.String configFileName)
DOCUMENT ME! |
protected void |
startReadConfigDaemon()
DOCUMENT ME! |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int REFRESH_SECONDS
protected java.util.HashSet serverPool
protected java.util.Iterator serverPoolI
protected java.util.Hashtable nameServer
protected java.util.ArrayList clientRecords
protected java.util.HashSet clientsToDisconnect
protected java.lang.Thread configRefreshDaemon
protected java.lang.String configFileName
protected int currGeneratedID
| Constructor Detail |
|---|
public MultiServerDaemon(java.util.ArrayList args)
throws java.lang.Exception
args - Element 0 of this arraylist is a String holding the file
name of the configuration file. Element 1 is a String holding
the file name of the log file.
java.lang.Exception - DOCUMENT ME!| Method Detail |
|---|
protected void startReadConfigDaemon()
protected void readXMLConfig(java.lang.String configFileName)
throws java.lang.Exception
configFileName - DOCUMENT ME!
java.lang.Exception - DOCUMENT ME!protected void addToDisconnectList(java.lang.String clientName)
clientName - DOCUMENT ME!protected java.util.HashSet clientRecordsForName(java.lang.String clientName)
clientName - DOCUMENT ME!
protected ServerRecord findSpecificServer(java.lang.String clientName)
clientName - DOCUMENT ME!
public java.lang.Object getID(java.lang.Object initialParameters)
throws java.rmi.RemoteException
getID in interface InteractiveTaskServerinitialParameters - Initial parameters from client local
configuration. The current client implementation, see
InteractiveTaskClient, provides the ip address of the client and
the command line paramaters used to launch the client. These
are packaged in a Vector.
java.rmi.RemoteException - DOCUMENT ME!
protected void disconnectClient()
throws java.rmi.RemoteException
java.rmi.RemoteException - DOCUMENT ME!
java.rmi.ConnectException - DOCUMENT ME!
protected void checkAndDisconnectClient(java.lang.Object id)
throws java.rmi.RemoteException
id - DOCUMENT ME!
java.rmi.RemoteException - DOCUMENT ME!
public InteractiveTask getTask(java.lang.Object id)
throws java.rmi.RemoteException
getTask in interface InteractiveTaskServerid - The ID provided by the getID method by which the client will
always refer to itself.
java.rmi.RemoteException - DOCUMENT ME!
public java.lang.Object interact(java.lang.Object id,
java.lang.Object clientTaskOutput)
throws java.rmi.RemoteException
interact in interface InteractiveTaskServerid - the client's IDclientTaskOutput - the outputs of the client obtained by task.get(
null ) on the client task
java.rmi.RemoteException - DOCUMENT ME!protected void println(java.lang.String text)
text - DOCUMENT ME!
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||