|
JCas v0.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cas.JCasServer
The main class for instatiating a MOARS server.
Nested Class Summary | |
protected class |
JCasServer.Monitor
Inner class that checks each connection thread if it timed out and creates or destroys spare threads in advance. |
protected class |
JCasServer.Reconfigurator
Inner class that waits for completion of all requests and re-reads the configuration. |
static class |
JCasServer.ShutdownHook
Inner class that logs the shutdown. |
Field Summary | |
protected JCasConfiguration |
configuration
The configuration |
protected List |
connectionThreads
The connection threads |
protected JCasServer.Monitor |
monitor
The monitor thread |
static long |
MONITOR_SLEEP_TIME
default sleep time for the monitor. |
protected boolean |
runServer
Tells if the server should run. |
protected ServerSocket |
serverSocket
The server socket |
protected Socket |
socket
The listener socket |
protected File |
xmlFile
The configuration file |
Constructor Summary | |
JCasServer(File xmlFile)
Creates a new instance of JCasServer. |
Method Summary | |
protected boolean |
assignFreeThread(Socket s)
Returns an available connection thread or creates a new one if necessary. |
protected void |
cleanupServer()
Cleans up all values for exiting or re-reading configuration. |
protected ServerSocket |
getServerSocket()
Creates the appropriate socket. |
protected void |
initServer()
Initializes all values according to the configuration. |
static void |
main(String[] args)
The argument must be a valid XML file. |
protected void |
readConfiguration()
Reads the configuration file. |
void |
run()
Runs the server. |
void |
scheduleReconfiguration()
Schedules the reading the configuration file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static long MONITOR_SLEEP_TIME
protected File xmlFile
protected Socket socket
protected JCasServer.Monitor monitor
protected List connectionThreads
protected boolean runServer
protected JCasConfiguration configuration
protected ServerSocket serverSocket
Constructor Detail |
public JCasServer(File xmlFile) throws IOException, SAXException, ParserConfigurationException
xmlFile
- - the CAS configuration file.Method Detail |
protected void readConfiguration() throws IOException, SAXException, ParserConfigurationException
IOException
- if the config file cannot be read.
SAXException
- if the parsing of the config file fails.
ParserConfigurationException
- if the SAX parser could not be configured.protected ServerSocket getServerSocket() throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected void initServer() throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected void cleanupServer() throws IOException
IOException
public void run()
run
in interface Runnable
protected boolean assignFreeThread(Socket s)
s
- socket to assign, if null, the threads are checked for availabilitypublic void scheduleReconfiguration()
JCasServer.Reconfigurator
public static void main(String[] args)
args
- the command line arguments
|
JCas v0.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |