|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.sdsc.inca.Component edu.sdsc.inca.Server
Nested Class Summary | |
protected class |
Server.ClientDispatcher
A class that listens on a server socket and adds new client connections to a work queue. |
protected class |
Server.ServerShutdownHook
This Class is run in a seperate thread when the server is shut down using ^C or SIGINT. |
Field Summary | |
static int |
ACCEPT_TIMEOUT
|
protected Server.ClientDispatcher |
cd
|
static int |
CLIENT_TIMEOUT
|
protected static org.apache.log4j.Logger |
logger
|
static java.lang.String |
SERVER_OPTS
|
protected java.net.ServerSocket |
ssocket
|
protected java.lang.String |
tempPath
|
protected int |
workerCount
|
protected Worker[] |
workers
|
protected WorkQueue |
workQueue
|
Fields inherited from class edu.sdsc.inca.Component |
authenticate, cert, certPath, COMPONENT_OPTS, hostname, key, keyPath, logFile, password, port, trusted, trustedPath |
Constructor Summary | |
Server()
|
Method Summary | |
java.lang.String |
getTempPath()
Returns the path where the server stores temporary files. |
int |
getWorkerCount()
Returns the number of worker threads this server uses. |
boolean |
isRunning()
Returns true iff the Server is accepting connections. |
static void |
main(java.lang.String[] args)
A main function to start a generic server. |
void |
runServer()
Start a thread that accepts and dispatches client connections. |
void |
setConfiguration(java.util.Properties config)
A convenience function for setting multiple configuration properties at once. |
void |
setTempPath(java.lang.String path)
Sets the directory path where the Server stores temporary files. |
void |
setWorkerCount(int count)
Sets the number of workers the Server uses to handle incoming messages. |
void |
shutdown()
Asks the Server to shutdown. |
Methods inherited from class edu.sdsc.inca.Component |
addTrustedCert, configComponent, createSocket, getAuthenticate, getCertificate, getCertificatePath, getHostname, getKey, getKeyPath, getLogFile, getPassword, getPort, getTrustedCertificates, getTrustedPath, getUri, openResourceStream, readCredentials, readVersion, setAuthenticate, setCertificatePath, setHostname, setKeyPath, setLogFile, setPassword, setPort, setTrustedPath |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ACCEPT_TIMEOUT
public static final int CLIENT_TIMEOUT
public static final java.lang.String SERVER_OPTS
protected static org.apache.log4j.Logger logger
protected java.lang.String tempPath
protected int workerCount
protected Server.ClientDispatcher cd
protected java.net.ServerSocket ssocket
protected WorkQueue workQueue
protected Worker[] workers
Constructor Detail |
public Server()
Method Detail |
public java.lang.String getTempPath()
public int getWorkerCount()
public boolean isRunning()
public void runServer() throws java.lang.Exception
java.lang.Exception
- if the server fails to startpublic void setConfiguration(java.util.Properties config) throws ConfigurationException
setConfiguration
in class Component
config
- contains server configuration values
ConfigurationException
- on a faulty configuration property valuepublic void setTempPath(java.lang.String path) throws ConfigurationException
path
- the temporary directory path
ConfigurationException
- if the path can't be read from the classpathpublic void setWorkerCount(int count)
count
- The (positive) worker countpublic void shutdown() throws java.lang.InterruptedException
java.lang.InterruptedException
- if the shutdown is interruptedpublic static void main(java.lang.String[] args)
usage:java edu.sdsc.inca.Server
-a,--auth yes|no Authenticate the connection? -c,--certPath to the server certificate -h,--help Prints a short help and usage statement -h,--hostname Hostname of server if different than what Java discovers -i,--init Path to server configuration properties file. -k,--key Path to the server key -n,--numthreads # of worker threads that the server runs -P,--password yes|no Read encryption password from stdin -p,--port The port for the server to listen on -t,--trusted Path to a directory containing all of the trusted certificates. -T,--taskwait # milliseconds for timing out task I/O -v,--var The directory the server should use to save temp files. Must be an absolute path. -V,--version Print program version and exit. -w,--wait # millisecs between shutdown checks
args
- command line arguments, as above.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |