|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
com.sun.slamd.client.Client
public class Client
This class defines a SLAMD client that can connect to the SLAMD server and interact with it to process the various jobs. Note that this version of the SLAMD client will only work on a single job at a time, although that job may spawn as many threads as it needs to operate. Also, this SLAMD client requires a Java version of at least 1.3 because it makes use of shutdown hooks to perform cleanup work when the client is shutting down.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static java.lang.String |
MAIN_THREAD_NAME
The name to assign to the main client thread. |
static java.lang.String |
SLAMD_CLIENT_VERSION
The version of the SLAMD client software being used. |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
Client(java.lang.String serverAddress,
int serverPort,
int serverStatPort,
boolean supportsTimeSync,
boolean enableRealTimeStats,
int statReportInterval,
boolean persistStatistics,
java.lang.String persistenceDirectory,
int persistenceInterval,
boolean restrictedMode,
boolean useCustomClassLoader,
java.lang.String classPath,
boolean useSSL,
boolean blindTrust,
java.lang.String sslKeyStore,
java.lang.String sslKeyStorePassword,
java.lang.String sslTrustStore,
java.lang.String sslTrustStorePassword,
ClientMessageWriter messageWriter)
Creates a new client that will communicate with the SLAMD server at the specified address and port, and will have the option of using SSL. |
|
Client(java.lang.String serverAddress,
int serverPort,
int serverStatPort,
boolean supportsTimeSync,
boolean enableRealTimeStats,
int statReportInterval,
boolean persistStatistics,
java.lang.String persistenceDirectory,
int persistenceInterval,
boolean useCustomClassLoader,
java.lang.String classPath,
ClientMessageWriter messageWriter)
Creates a new client that will communicate with the SLAMD server at the specified address and port. |
|
Client(java.lang.String serverAddress,
int serverPort,
int serverStatPort,
boolean supportsTimeSync,
boolean enableRealTimeStats,
int statReportInterval,
boolean persistStatistics,
java.lang.String persistenceDirectory,
int persistenceInterval,
int authType,
java.lang.String authID,
java.lang.String authCredentials,
boolean restrictedMode,
boolean useCustomClassLoader,
java.lang.String classPath,
boolean useSSL,
boolean blindTrust,
java.lang.String sslKeyStore,
java.lang.String sslKeyStorePassword,
java.lang.String sslTrustStore,
java.lang.String sslTrustStorePassword,
ClientMessageWriter messageWriter)
Creates a new client that will communicate with the SLAMD server at the specified address and port, and will use the specified authentication type and optionally may use SSL. |
|
Client(java.lang.String serverAddress,
int serverPort,
int serverStatPort,
boolean supportsTimeSync,
boolean enableRealTimeStats,
int statReportInterval,
boolean persistStatistics,
java.lang.String persistenceDirectory,
int persistenceInterval,
int authType,
java.lang.String authID,
java.lang.String authCredentials,
boolean restrictedMode,
boolean useCustomClassLoader,
java.lang.String classPath,
ClientMessageWriter messageWriter)
Creates a new client that will communicate with the SLAMD server at the specified address and port, and will use the specified authentication type. |
|
| Method Summary | |
|---|---|
boolean |
aggregateThreadData()
Indicates whether the client should aggregate the data collected from all the threads before sending the results to the SLAMD server. |
void |
aggregateThreadData(boolean aggregateThreadData)
Specifies whether the client should aggregate the data collected from all the threads before sending the results to the SLAMD server. |
void |
disconnect()
Disconnects the client from the SLAMD server. |
java.lang.String |
getAuthenticationID()
Retrieves the ID that the client used when authenticating to the server. |
int |
getAuthType()
Retrieves the type of authentication that the client used. |
java.lang.String |
getClassPath()
Retrieves the path to which Java class files sent by the server will be written. |
java.lang.String |
getClientID()
Retrieves the user-friendly client ID that should show up in log messages. |
int |
getMessageID()
Retrieves the message ID that the client should use for the next message that will be sent to the SLAMD server. |
ClientMessageWriter |
getMessageWriter()
Retrieves the message writer associated with this client. |
java.lang.String |
getServerAddress()
Retrieves the address of the SLAMD server to which this client is connected. |
int |
getServerPort()
Retrieves the port on which the SLAMD client is communicating with the SLAMD server. |
java.lang.String |
getSSLKeyStore()
Retrieves the location of the SSL key store that this client is using. |
java.lang.String |
getSSLTrustStore()
Retrieves the location of the SSL trust store that this client is using. |
static StatPersistenceThread |
getStatPersistenceThread()
Retrieves the reference to the thread used for persisting statistical data on disk. |
void |
handleJobControlRequest(JobControlRequestMessage request)
Performs any work requested by the provide job control request and sends the appropriate response. |
void |
handleJobRequest(JobRequestMessage request)
Configures the client to start processing the new job specified in the job request and sends the appropriate response. |
void |
handleStatusRequestMessage(StatusRequestMessage request)
Handles the provided status request by gathering the requested information and sending it back to the server. |
void |
jobDone()
Used by the job to indicate to the client that it has completed processing and that the client should gather all the appropriate summary information and send it back to the server. |
static void |
registerPersistentStatistic(StatTracker tracker)
Registers the provided stat tracker with the persistence thread so that its data will be periodically persisted on disk. |
void |
run()
Loop infinitely waiting for a request to come in. |
void |
sendMessage(Message message)
Sends the requested message to the SLAMD server. |
void |
setShutdownListener(ClientShutdownListener shutdownListener)
Specifies the listener that should be notified when the client stops running. |
int |
startJob()
Attempts to start the current job. |
int |
stopJob(int stopReason,
boolean waitForStop)
Attempts to stop the current job. |
boolean |
usingSSL()
Indicates whether the connection between the client and the server is using SSL. |
void |
writeMessage(java.lang.String message)
Writes a message that may be seen by clients. |
void |
writeVerbose(java.lang.String message)
Writes a verbose message that may be seen by clients if they have enabled verbose messages. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SLAMD_CLIENT_VERSION
public static final java.lang.String MAIN_THREAD_NAME
| Constructor Detail |
|---|
public Client(java.lang.String serverAddress,
int serverPort,
int serverStatPort,
boolean supportsTimeSync,
boolean enableRealTimeStats,
int statReportInterval,
boolean persistStatistics,
java.lang.String persistenceDirectory,
int persistenceInterval,
boolean useCustomClassLoader,
java.lang.String classPath,
ClientMessageWriter messageWriter)
throws ClientException
serverAddress - The IP address or DNS hostname of the SLAMD
server.serverPort - The port number on which the SLAMD server is
listening for client connections.serverStatPort - The port number on which the SLAMD server
listens for real-time statistical data.supportsTimeSync - Indicates whether the client should support
time synchronization with the server.enableRealTimeStats - Indicates whether the client should support
the collection of real-time statistics for
reporting back to the SLAMD server.statReportInterval - The length of time in seconds between stat
updates to the server.persistStatistics - Indicates whether the client should
periodically save statistical data on disk.persistenceDirectory - The directory in which the persisted data
will be written.persistenceInterval - The interval in seconds between saves of the
persistence data.useCustomClassLoader - Indicates whether to use the custom class
loader for loading job classes.classPath - The path to which Java class files will be
written if they are sent from the client to
the server using a class transfer response.messageWriter - The writer to which informational and verbose
messages will be written.
ClientException - If some problem is encountered while creating the
client.
public Client(java.lang.String serverAddress,
int serverPort,
int serverStatPort,
boolean supportsTimeSync,
boolean enableRealTimeStats,
int statReportInterval,
boolean persistStatistics,
java.lang.String persistenceDirectory,
int persistenceInterval,
boolean restrictedMode,
boolean useCustomClassLoader,
java.lang.String classPath,
boolean useSSL,
boolean blindTrust,
java.lang.String sslKeyStore,
java.lang.String sslKeyStorePassword,
java.lang.String sslTrustStore,
java.lang.String sslTrustStorePassword,
ClientMessageWriter messageWriter)
throws ClientException
serverAddress - The IP address or DNS hostname of the SLAMD
server.serverPort - The port number on which the SLAMD server is
listening for client connections.serverStatPort - The port number on which the SLAMD server
listens for real-time statistical data.supportsTimeSync - Indicates whether the client should support
time synchronization with the server.enableRealTimeStats - Indicates whether the client should support
the collection of real-time statistics for
reporting back to the SLAMD server.statReportInterval - The length of time in seconds between stat
updates to the server.persistStatistics - Indicates whether the client should
periodically save statistical data on disk.persistenceDirectory - The directory in which the persisted data
will be written.persistenceInterval - The interval in seconds between saves of the
persistence data.restrictedMode - Indicates whether this client will operate
in restricted mode, meaning that the server
should only ask it to run jobs for which it
has been explicitly requested.useCustomClassLoader - Indicates whether to use the custom class
loader for loading job classes.classPath - The path to which Java class files will be
written if they are sent from the client to
the server using a class transfer response.useSSL - Indicates whether SSL will be used on the
connection between the client and the
server.blindTrust - Indicates whether the client should blindly
trust any SSL certificate presented by the
SLAMD server.sslKeyStore - The location of the JSSE key store that will
be used if the communication between the
client and the server is SSL-based.sslKeyStorePassword - The password needed to access the SSL key
store.sslTrustStore - The location of the JSSE trust store that
will be used if the communication between
the client and the server is SSL-based.sslTrustStorePassword - The password needed to access the SSL trust
storemessageWriter - The writer to which informational and
verbose messages will be written.
ClientException - If some problem is encountered while creating the
client.
public Client(java.lang.String serverAddress,
int serverPort,
int serverStatPort,
boolean supportsTimeSync,
boolean enableRealTimeStats,
int statReportInterval,
boolean persistStatistics,
java.lang.String persistenceDirectory,
int persistenceInterval,
int authType,
java.lang.String authID,
java.lang.String authCredentials,
boolean restrictedMode,
boolean useCustomClassLoader,
java.lang.String classPath,
ClientMessageWriter messageWriter)
throws ClientException
serverAddress - The IP address or DNS hostname of the SLAMD
server.serverPort - The port number on which the SLAMD server is
listening for client connections.serverStatPort - The port number on which the SLAMD server
listens for real-time statistical data.supportsTimeSync - Indicates whether the client should support
time synchronization with the server.enableRealTimeStats - Indicates whether the client should support
the collection of real-time statistics for
reporting back to the SLAMD server.statReportInterval - The length of time in seconds between stat
updates to the server.persistStatistics - Indicates whether the client should
periodically save statistical data on disk.persistenceDirectory - The directory in which the persisted data
will be written.persistenceInterval - The interval in seconds between saves of the
persistence data.authType - The type of authentication to perform with
the SLAMD server.authID - The ID to use to authenticate to the SLAMD
server.authCredentials - The credentials that will be used to
authenticate to the SLAMD server.restrictedMode - Indicates whether this client should operate
in restricted mode.useCustomClassLoader - Indicates whether to use the custom class
loader for loading job classes.classPath - The path to which Java class files will be
written if they are sent from the client to
the server using a class transfer response.messageWriter - The writer to which informational and verbose
messages will be written.
ClientException - If some problem is encountered while creating the
client.
public Client(java.lang.String serverAddress,
int serverPort,
int serverStatPort,
boolean supportsTimeSync,
boolean enableRealTimeStats,
int statReportInterval,
boolean persistStatistics,
java.lang.String persistenceDirectory,
int persistenceInterval,
int authType,
java.lang.String authID,
java.lang.String authCredentials,
boolean restrictedMode,
boolean useCustomClassLoader,
java.lang.String classPath,
boolean useSSL,
boolean blindTrust,
java.lang.String sslKeyStore,
java.lang.String sslKeyStorePassword,
java.lang.String sslTrustStore,
java.lang.String sslTrustStorePassword,
ClientMessageWriter messageWriter)
throws ClientException
serverAddress - The IP address or DNS hostname of the SLAMD
server.serverPort - The port number on which the SLAMD server is
listening for client connections.serverStatPort - The port number on which the SLAMD server
listens for real-time statistical data.supportsTimeSync - Indicates whether the client should support
time synchronization with the server.enableRealTimeStats - Indicates whether the client should support
the collection of real-time statistics for
reporting back to the SLAMD server.statReportInterval - The length of time in seconds between stat
updates to the server.persistStatistics - Indicates whether the client should
periodically save statistical data on disk.persistenceDirectory - The directory in which the persisted data
will be written.persistenceInterval - The interval in seconds between saves of the
persistence data.authType - The type of authentication to perform with
the SLAMD server.authID - The ID to use to authenticate to the SLAMD
server.authCredentials - The credentials that will be used to
authenticate to the SLAMD server.restrictedMode - Indicates whether this client will operate
in restricted mode, meaning that the server
should only ask it to run jobs for which it
has been explicitly requested.useCustomClassLoader - Indicates whether to use the custom class
loader for loading job classes.classPath - The path to which Java class files will be
written if they are sent from the client to
the server using a class transfer response.useSSL - Indicates whether SSL will be used on the
connection between the client and the
server.blindTrust - Indicates whether the client should blindly
trust any SSL certificate presented by the
SLAMD server.sslKeyStore - The location of the JSSE key store that will
be used if the communication between the
client and the server is SSL-based.sslKeyStorePassword - The password needed to access the SSL key
store.sslTrustStore - The location of the JSSE trust store that
will be used if the communication between
the client and the server is SSL-based.sslTrustStorePassword - The password needed to access the SSL trust
storemessageWriter - The writer to which informational and
verbose messages will be written.
ClientException - If some problem is encountered while creating the
client.| Method Detail |
|---|
public void disconnect()
public ClientMessageWriter getMessageWriter()
public void setShutdownListener(ClientShutdownListener shutdownListener)
shutdownListener - The listener that should be notified when the
client stops running.public boolean aggregateThreadData()
true if the client should aggregate the thread data
before sending the results to the SLAMD server, or
false if the data for each thread is to be reported
separately.public void aggregateThreadData(boolean aggregateThreadData)
aggregateThreadData - Specifies whether the client should aggregate
the data collected from all the threads before
sending the results to the SLAMD server.public boolean usingSSL()
true if the communication between the client and the
server is using SSL, or false if not.public int getAuthType()
public int getServerPort()
public java.lang.String getAuthenticationID()
public java.lang.String getClassPath()
public java.lang.String getClientID()
public java.lang.String getServerAddress()
public java.lang.String getSSLKeyStore()
public java.lang.String getSSLTrustStore()
public static StatPersistenceThread getStatPersistenceThread()
null if client-side persistence is not
enabled.public static void registerPersistentStatistic(StatTracker tracker)
tracker - The stat tracker to register with the persistence thread.public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void handleJobControlRequest(JobControlRequestMessage request)
request - The job control request to be processed.public void handleJobRequest(JobRequestMessage request)
request - The job request to be processed.public void handleStatusRequestMessage(StatusRequestMessage request)
request - The status request to be processed.
public void sendMessage(Message message)
throws java.io.IOException
message - The message to send to the SLAMD server.
java.io.IOException - If a problem occurs while sending the message to the
SLAMD server.public int startJob()
public int stopJob(int stopReason,
boolean waitForStop)
stopReason - The reason that the job is to be stopped.waitForStop - Indicates whether this method should wait for the job
to actually stop before returning, or if it should
return as soon as the stop signal has been issued.
public void jobDone()
public int getMessageID()
public void writeMessage(java.lang.String message)
message - The message to be written.public void writeVerbose(java.lang.String message)
message - The message to be written.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||