|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectproper.core.ProperObject
proper.core.ArgumentObject
proper.app.Application
proper.remote.Server
proper.remote.JobServer
public class JobServer
This class is a server for performing distributed computation.
The clients register and unregister themselves with the server, which
handles a queue of jobs.
Every Request that is sent between Server and Client has the type of request
in the first line.
The job list that the server reads is a simple text file where each line is
either a comment (line is starting with a "#") or a real job. A real job
consists of the class that should be executed and then the necessary
parameters to run this class. The "-log" is added automatically.
For a complete list of commandline parameters just run it with the option
"-help".
JobClient
Field Summary | |
---|---|
static java.lang.String |
JOB_DISTRIBUTE
this "job" means, that the server sends all received files to all the cliens before continuing ("synchronize" should be before this) |
static java.lang.String |
JOB_SYNCHRONIZE
this "job" means, that all pending jobs have to be finished before continuing |
static int |
JOBLIST
the identifier for the normal list |
static int |
JOBLIST_DONE
the identifier for the Done list |
static int |
JOBLIST_FAILED
the identifier for the Failed list |
static int |
JOBLIST_TODO
the identifier for the ToDo list |
static int |
LIST_ADDITIONAL
the identifier for clients with additional jobs, still working |
static int |
LIST_AVAILABLE
the identifier for the available clients |
static int |
LIST_PENDING
the identifier for pending clients, still working on something |
static int |
PORT
the standard port to bind to |
static java.lang.String |
REQUEST_ADDITIONAL
with this request the server sends back the additional jobs |
static java.lang.String |
REQUEST_ADDITIONALADD
with this request the client is performing an additional job |
static java.lang.String |
REQUEST_ADDITIONALFAILED
with this request the client has failed with an additional job |
static java.lang.String |
REQUEST_ADDITIONALREMOVE
with this request the client has finished an additional job |
static java.lang.String |
REQUEST_ADDJOBS
with this request the server adds the new jobs to the queue |
static java.lang.String |
REQUEST_CLIENTS
with this request the server sends back the current clients |
static java.lang.String |
REQUEST_DELETEJOB
with this request the server deletes the specified job |
static java.lang.String |
REQUEST_FAILED
with this request the client returns that the job failed |
static java.lang.String |
REQUEST_FILE
with this request the client sends a file to the server |
static java.lang.String |
REQUEST_GETFILE
with this request the server requests a file from the client |
static java.lang.String |
REQUEST_JOB
with this request the client gets a job |
static java.lang.String |
REQUEST_JOBSDONE
with this request the server sends back the jobs already done |
static java.lang.String |
REQUEST_JOBSFAILED
with this request the server sends back the jobs that failed |
static java.lang.String |
REQUEST_JOBSTODO
with this request the server sends back the jobs still in queue |
static java.lang.String |
REQUEST_KILL
with this request the client must do a System.exit() |
static java.lang.String |
REQUEST_NEXTJOB
with this request the server conitnues with the next job |
static java.lang.String |
REQUEST_PENDING
with this request the server sends back the pending jobs |
static java.lang.String |
REQUEST_REGISTER
with this request the client registers itself with the server |
static java.lang.String |
REQUEST_REREGISTER
with this request the client re-registers itself with the server |
static java.lang.String |
REQUEST_RESULT
with this request the client returns the result from a job |
static java.lang.String |
REQUEST_SHUTDOWN
this request is sent to the clients, when the server shuts down |
static java.lang.String |
REQUEST_UNREGISTER
with this request the client un-registers itself with the server |
Fields inherited from class proper.remote.Server |
---|
ALIVE_CHECK, LIST_CLIENTS, REQUEST_ISALIVE, REQUEST_NOP |
Fields inherited from interface proper.core.ProperInterface |
---|
VERSION |
Constructor Summary | |
---|---|
JobServer()
initializes the object |
Method Summary | |
---|---|
void |
addJobs(java.util.Vector lines)
adds the given jobs to the job-queue |
void |
doDistributing()
checks whether we have to distribute all the files we received so far to all the clients |
ClientList |
getClientList(int type)
returns the specified clientlist |
java.util.Stack |
getJobs()
returns the jobs |
java.util.Vector |
getJobs(int type)
returns the jobs, depending on the type (NULL if wrong type) |
java.lang.String |
getJobsFilename()
returns the name of the Jobs file |
java.lang.String |
getJobsFilename(int list)
returns the name of the Jobs file, depending on the list type |
java.util.Vector |
getReceived()
returns the list with the received files |
boolean |
isOperational()
this method determines whether the server should continue accepting connections or not |
boolean |
isSynchronizing()
checks whether we have to wait for all the pending jobs to finished, before we can proceed with the next job |
static void |
main(java.lang.String[] args)
starts the application |
void |
printDescription()
prints a short description of this class |
void |
sendKill()
sends a KILL to all the clients |
void |
sendShutdown()
sends a shutdown to all the clients |
Methods inherited from class proper.remote.Server |
---|
addToAccessLog, addToErrorLog, checkClients, createMessage, createMessage, getHostName, getPort |
Methods inherited from class proper.app.Application |
---|
checkCommandLine, createInstance, fromXML, parameterError, printUsage, run, run, setArgs, setArgs, toString, toXML |
Methods inherited from class proper.core.ArgumentObject |
---|
fixAdditionalArg |
Methods inherited from class proper.core.ProperObject |
---|
addListener, addOutput, classInVerbose, debugprint, debugprint, debugprint, debugprint, debugprintln, debugprintln, debugprintln, debugprintln, debugprintln, getListeners, getRuntime, getVerbose, getVerboseLevel, getVerboseLevelForClass, getVerboseString, getVerboseStringForClass, notifyListener, notifyListeners, print, print, print, print, println, println, println, println, println, printMemory, removeListener, setOutput, setVerbose, setVerboseLevel, setVerboseString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int PORT
public static final java.lang.String REQUEST_REGISTER
public static final java.lang.String REQUEST_UNREGISTER
public static final java.lang.String REQUEST_REREGISTER
public static final java.lang.String REQUEST_KILL
public static final java.lang.String REQUEST_JOB
public static final java.lang.String REQUEST_NEXTJOB
public static final java.lang.String REQUEST_DELETEJOB
public static final java.lang.String REQUEST_RESULT
public static final java.lang.String REQUEST_FAILED
public static final java.lang.String REQUEST_GETFILE
public static final java.lang.String REQUEST_FILE
public static final java.lang.String REQUEST_ADDJOBS
public static final java.lang.String REQUEST_ADDITIONALADD
public static final java.lang.String REQUEST_ADDITIONALREMOVE
public static final java.lang.String REQUEST_ADDITIONALFAILED
public static final java.lang.String REQUEST_JOBSTODO
public static final java.lang.String REQUEST_JOBSDONE
public static final java.lang.String REQUEST_JOBSFAILED
public static final java.lang.String REQUEST_CLIENTS
public static final java.lang.String REQUEST_PENDING
public static final java.lang.String REQUEST_ADDITIONAL
public static final java.lang.String REQUEST_SHUTDOWN
public static final int LIST_AVAILABLE
public static final int LIST_PENDING
public static final int LIST_ADDITIONAL
public static final int JOBLIST
public static final int JOBLIST_TODO
public static final int JOBLIST_DONE
public static final int JOBLIST_FAILED
public static final java.lang.String JOB_SYNCHRONIZE
public static final java.lang.String JOB_DISTRIBUTE
Constructor Detail |
---|
public JobServer()
Method Detail |
---|
public void printDescription()
printDescription
in interface CommandLineInterface
printDescription
in class Application
public void addJobs(java.util.Vector lines)
public java.lang.String getJobsFilename()
public java.lang.String getJobsFilename(int list)
JOBLIST_TODO
,
JOBLIST_DONE
,
JOBLIST_FAILED
public java.util.Stack getJobs()
public java.util.Vector getJobs(int type)
public boolean isSynchronizing()
public void doDistributing() throws java.lang.Exception
java.lang.Exception
public java.util.Vector getReceived()
public ClientList getClientList(int type)
getClientList
in class Server
public void sendShutdown()
public void sendKill()
public boolean isOperational()
isOperational
in class Server
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |