|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--galaxy.server.ServerCreationThread
This is a thread that creates and starts new instances of
Server
. This class must be extended.
Field Summary | |
protected static int |
CLIENT
Hub client thread type. |
protected GalaxyInputStream |
in
This threads input stream. |
protected boolean |
isRunning
Flag that indicates if this thread is running. |
protected static int |
LISTENER
Listener thread type. |
protected MainServer |
mainServer
The MainServer that created this thread. |
protected GalaxyOutputStream |
out
This threads output stream. |
protected java.lang.Thread |
thread
Reference to this thread. |
protected int |
threadType
This thread's type. |
protected boolean |
tooManyServers
This flag is set if there was an attempt to start too many servers. |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
ServerCreationThread(java.lang.String name,
MainServer mainServer,
int threadType)
Creats a new thread that creates servers. |
Method Summary | |
protected Server |
createServer(java.net.Socket clientSocket,
java.lang.String sessionId)
Creates a new server to handle a new connection. |
boolean |
isRunning()
|
protected void |
logErrorMessage(java.lang.String message)
|
protected void |
logErrorMessage(java.lang.String message,
java.lang.Exception ex)
|
protected void |
logErrorMessage(java.lang.String message,
java.lang.Exception ex,
java.lang.String location)
|
protected void |
logErrorMessage(java.lang.String message,
java.lang.String location)
|
protected void |
logMessage(java.lang.String message,
int level)
|
protected void |
logMessage(java.lang.String message,
int level,
java.lang.String location)
|
protected void |
logWarningMessage(java.lang.String message)
|
protected void |
logWarningMessage(java.lang.String message,
java.lang.String location)
|
abstract void |
run()
The main routine for this thread. |
protected java.lang.Thread |
startServer(Server server)
Starts the specified server. |
void |
stopThread()
Marks this broker's thread as being interrupted. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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 |
protected static final int LISTENER
protected static final int CLIENT
protected int threadType
protected MainServer mainServer
MainServer
that created this thread.protected GalaxyInputStream in
protected GalaxyOutputStream out
protected java.lang.Thread thread
protected boolean tooManyServers
protected volatile boolean isRunning
Constructor Detail |
public ServerCreationThread(java.lang.String name, MainServer mainServer, int threadType)
mainServer
- the MainServer
that created this threadthreadType
- the type of thread created (e.g., a listener, a
Hub client). The valid values are defined in
this class.Method Detail |
protected void logMessage(java.lang.String message, int level)
protected void logMessage(java.lang.String message, int level, java.lang.String location)
protected void logWarningMessage(java.lang.String message)
protected void logWarningMessage(java.lang.String message, java.lang.String location)
protected void logErrorMessage(java.lang.String message, java.lang.Exception ex)
protected void logErrorMessage(java.lang.String message)
protected void logErrorMessage(java.lang.String message, java.lang.Exception ex, java.lang.String location)
protected void logErrorMessage(java.lang.String message, java.lang.String location)
public abstract void run()
run
in class java.lang.Thread
public void stopThread()
public boolean isRunning()
protected Server createServer(java.net.Socket clientSocket, java.lang.String sessionId)
MainServer.serverClassName
.clientSocket
- the client connection that is to be associated with
the new serversessionId
- initial session id of the serverprotected java.lang.Thread startServer(Server server) throws java.lang.Exception
Server.init
is invoked on
the server to perform custom initialization. Just before the server is
started, listeners registered with MainServer
are notified
by calling MainServer.fireNewServer
.server
- the server to start
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |