|
||||||||||
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 java.lang.String |
hostname
|
protected static org.apache.log4j.Logger |
logger
|
protected int |
port
|
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, key, keyPath, logFile, password, trusted, trustedPath |
Constructor Summary | |
Server()
|
Method Summary | |
java.lang.String |
getHostname()
Returns the name of the host where this server is running. |
int |
getPort()
Returns the port associated with a Server Object. |
java.lang.String |
getTempPath()
Returns the path where the server stores temporary files. |
java.lang.String |
getUri()
Return the uri for the server. |
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 |
setHostname(java.lang.String hostname)
Sets the name of the host where this server is running. |
void |
setPort(int port)
Set the port to bind to. |
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, getKey, getKeyPath, getLogFile, getPassword, getTrustedCertificates, getTrustedPath, openResourceStream, readCredentials, readVersion, setAuthenticate, setCertificatePath, setKeyPath, setLogFile, setPassword, 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 hostname
protected int port
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 getHostname()
public int getPort()
public java.lang.String getTempPath()
public java.lang.String getUri()
public int getWorkerCount()
public boolean isRunning()
public void runServer()
public 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 setHostname(java.lang.String hostname)
hostname
- A string containing the hostname of the serverpublic void setPort(int port)
port
- port numberpublic 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 -i,--init Path to server configuration properties file. -k,--key Path to the server key -h,--hostname Hostname of server if different than what Java discovers -n,--numthreads # of worker threads that the server runs -p,--port The port for the server to listen on -P,--password yes|no Read encryption password from stdin -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 |