|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
com.dalsemi.shell.server.Server
A generic server. Servers will listen on some system resource for connection requests. When someone attempts to login, the server spins off a session to handle that login. Servers are designed to be multi-threaded, allowing multiple simultaneous connections.
| Field Summary | |
protected java.util.Vector |
sessions
List of sessions created by this server. |
protected boolean |
shutdown
Stops this server when set to true. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
protected |
Server()
Initializes the server and creates the list of sessions (initially empty). |
| Method Summary | |
protected abstract Session |
acceptNewSession()
Waits for a connection request. |
void |
broadcast(java.lang.String sendThis)
Cycles through the list of know sessions, sending the specified message. |
protected void |
checkForNewSessions()
Listens for connection requests. |
protected abstract void |
closeAllPorts()
Cleans up any system resources held by this server. |
java.lang.String[] |
getConnectedUsers()
Gets an array of the names of all of the users that are currently connected to this server. |
void |
run()
Starts the server. |
void |
sessionEnded(Session session)
Notifies this server that a particular session is ending. |
void |
shutDown()
Requests that the server stop taking connections and terminate any current sessions. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, 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 java.util.Vector sessions
protected boolean shutdown
| Constructor Detail |
protected Server()
| Method Detail |
public void run()
shutdown field is set to true.
protected void checkForNewSessions()
protected abstract Session acceptNewSession()
public void shutDown()
throws java.io.IOException
java.io.IOExceptionpublic void sessionEnded(Session session)
session - the session that has terminatedpublic java.lang.String[] getConnectedUsers()
public void broadcast(java.lang.String sendThis)
sendThis - message to send to all sessions
protected abstract void closeAllPorts()
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||