|
||||||||||
| 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.ClientConnection
This class defines a thread that is spawned by the server to handle each 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 | |
ClientConnection(SLAMDServer slamdServer,
ClientListener clientListener,
java.net.Socket clientConnection,
java.lang.String connectionID)
Creates a new connection that the server will use to communicate with the client. |
|
| Method Summary | |
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. |
Job |
getJob()
Retrieves the job that the client is currently processing (if any). |
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 |
restrictedMode()
Indicates whether this client is operating in restricted mode, in which case it will only be used to handle jobs for which it has been explicitly requested. |
void |
run()
Listens for messages from the client and either handles them or hands them off to be handled elsewhere. |
void |
sendClassFile(ClassTransferRequestMessage transferRequest)
Sends a class transfer response message to the client that either contains the requested class information or a response code that indicates why it could not be provided. |
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 ClientConnection(SLAMDServer slamdServer,
ClientListener clientListener,
java.net.Socket clientConnection,
java.lang.String connectionID)
throws SLAMDException
slamdServer - The SLAMD server with which this connection is
associated.clientListener - The 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 there is a problem with the client 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 restrictedMode()
true if this client is operating in restricted mode,
or false if it is not.public Job getJob()
null if it is not processing any job.public void run()
public void sendMessage(Message message)
message - The message to send to the client.public void sendClassFile(ClassTransferRequestMessage transferRequest)
transferRequest - The class transfer request message for which the
response is to be provided.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 | |||||||||