|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
com.sun.slamd.server.ResourceMonitorClientConnection
This class defines a thread that is spawned by the server to handle each resource monitor client connection. It takes care of reading messages in from the client and provides methods for sending messages to the client.
| Field Summary |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
ResourceMonitorClientConnection(SLAMDServer slamdServer,
ResourceMonitorClientListener clientListener,
java.net.Socket clientConnection,
java.lang.String connectionID)
Creates a new resource monitor connection that the server will use to communicate with the client. |
|
| Method Summary | |
void |
addJobInProgress(Job job)
Adds the provided job to the list of jobs in progress. |
java.lang.String |
getClientID()
Retrieves the client ID that the client has chosen for itself. |
java.lang.String |
getClientIPAddress()
Retrieves the IP address of the client associated with this connection. |
java.lang.String |
getConnectionID()
Retrieves the connection ID assigned to this client connection by the SLAMD server. |
java.util.Date |
getEstablishedTime()
Retrieves the time at which this connection was established. |
java.lang.String[] |
getJobIDsInProgress()
Retrieves the list of jobs for which this client is collecting resource utilization data. |
Job |
getJobInProgress(java.lang.String jobID)
Retrieves information about the specified job in progress. |
Job[] |
getJobsInProgress()
Retrieves the list of jobs for which this client is collecting resource utilization data. |
int |
getMessageID()
Retrieves the message ID to use in the next message originating from the server. |
Message |
getResponse(int messageID,
int messageType)
Retrieves a message with the specified message ID and type from the queue used to hold responses to solicited messages. |
java.lang.String |
getStatusString()
Retrieves a string with basic status information about the current state of the client. |
boolean |
jobInProgress()
Indicates whether at least one job is in progress. |
void |
removeJobInProgress(Job job)
Removes the provided job from the list of jobs in progress. |
void |
run()
Listens for messages from the client and either handles them or hands them off to be handled elsewhere. |
JobControlResponseMessage |
sendJobControlRequest(Job job,
int controlType)
Sends a job control request to the client for the specified job. |
JobResponseMessage |
sendJobRequest(Job job,
int clientNumber)
Sends a job request message to the client. |
void |
sendMessage(Message message)
Sends the specified message to the client. |
void |
sendServerShutdownMessage(boolean closeSocket)
Sends a message to the client that indicates the server is shutting down, and then optionally closes the connection to the client. |
StatusResponseMessage |
sendStatusRequestMessage()
Sends a status request message to the client as a general status request. |
StatusResponseMessage |
sendStatusRequestMessage(java.lang.String jobID)
Sends a status request message to the client requesting information about the specified job. |
java.lang.String |
toString()
Retrieves a string with information about this client connection. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ResourceMonitorClientConnection(SLAMDServer slamdServer,
ResourceMonitorClientListener clientListener,
java.net.Socket clientConnection,
java.lang.String connectionID)
throws SLAMDException
slamdServer - The SLAMD server with which this connection is
associated.clientListener - The resource monitor client listener that
accepted this connection.clientConnection - The socket that is used to communicate with the
client.connectionID - The unique identifier associated with the client.
SLAMDException - If a problem occurs setting up the connection.| Method Detail |
public java.lang.String getConnectionID()
public java.lang.String getClientID()
public java.util.Date getEstablishedTime()
public java.lang.String getClientIPAddress()
public boolean jobInProgress()
true if at least one job is in progress, or
false if there are no jobs in progress.public Job[] getJobsInProgress()
public java.lang.String[] getJobIDsInProgress()
public Job getJobInProgress(java.lang.String jobID)
jobID - The job ID of the job for which to retrieve information.
null if no information is available.public void addJobInProgress(Job job)
job - The job to add to the list of jobs in progress.public void removeJobInProgress(Job job)
job - The job to remove from the list of jobs in progress.public void run()
public void sendMessage(Message message)
message - The message to send to the client.public int getMessageID()
public Message getResponse(int messageID,
int messageType)
null.
messageID - The message ID for the message that is expected.messageType - The type of message that is expected.
public JobResponseMessage sendJobRequest(Job job,
int clientNumber)
job - The information that should be included in the job
request.clientNumber - The client number for this client.
public JobControlResponseMessage sendJobControlRequest(Job job,
int controlType)
job - The job with which the request is associated.controlType - The type of operation being requested.
public StatusResponseMessage sendStatusRequestMessage()
public StatusResponseMessage sendStatusRequestMessage(java.lang.String jobID)
jobID - The ID of the job for which to request status information.
public void sendServerShutdownMessage(boolean closeSocket)
closeSocket - Indicates whether the connection to the client should
be closed.public java.lang.String toString()
public java.lang.String getStatusString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||