|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
SundayServer
A class that implements Joe Sunday's Drink Protocol for the TINI-board based Drink Server (although, in theory it is abstracted enough to be used on anything that has a DrinkMachineSpec class).
| Nested Class Summary | |
class |
SundayServer.SundayClientThread
This inner class represents an individual client connection to the server. |
| Field Summary | |
private AcctMgrSpec |
acctMgr
The account manager |
private int |
clientCount
How many clients are currently connected. |
private ConfigMgr |
configMgr
Where we get our runtime configuration values from. |
private DrinkMachineSpec |
drink
The logger. |
private ServerSocket |
listen
The socket we listen for connections from clients on. |
private String |
location
A description of the location of the machine. |
private DrinkLoggerSpec |
log
The drink machine |
private int |
maxClients
The maximum number of clients we are to allow to connect. |
private int |
maxDelay
The maximum a user can request that the drop be delayed for. |
private String |
motd
The message of the day to display to users. |
private int |
port
The port to listen on for client connections. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
SundayServer(DrinkMachineSpec inDrink,
AcctMgrSpec inAcctMgr,
DrinkLoggerSpec inLog,
ConfigMgr inConfigMgr)
Constructor. |
|
| Method Summary | |
boolean |
addClient()
If MAXCLIENTS has not been reached, then increment clientCount and return true, otherwise return false. |
boolean |
removeClient()
If clientCount is not zero, then decrement clientCount and return true, otherwise return false. |
void |
run()
The run method accepts client connections. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, 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 |
private ServerSocket listen
private int port
private int clientCount
private AcctMgrSpec acctMgr
private DrinkMachineSpec drink
private DrinkLoggerSpec log
private ConfigMgr configMgr
private int maxClients
private int maxDelay
private String motd
private String location
| Constructor Detail |
public SundayServer(DrinkMachineSpec inDrink,
AcctMgrSpec inAcctMgr,
DrinkLoggerSpec inLog,
ConfigMgr inConfigMgr)
inDrink - Reference to the Systemwide DrinKMachine objectinAcctMgr - Reference to the Systemwide AcctMgrSpec objectinLog - Reference to the Systemwide DrinkLoggerSpec objectinConfigMgr - The ConfigMgr to get config values from.| Method Detail |
public void run()
public boolean addClient()
public boolean removeClient()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||