vooga.engine.networking.server
Class VoogaDaemon

java.lang.Object
  extended by java.lang.Thread
      extended by vooga.engine.networking.server.VoogaDaemon
All Implemented Interfaces:
java.lang.Runnable

public class VoogaDaemon
extends java.lang.Thread

Thread that is run on the server 24/7 for each game using the networking API. It creates the sockets that the game will be communicating over and initiates the ChatHandler and ClientHandler subclass for every connection.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 int numberOfGames
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
VoogaDaemon(int gamePortNumber, int chatPortNumber, int numberOfPlayers, java.lang.String clientHandler)
          Static method to return the XML document with the list of games that can be run on the networking Vooga servers.
 
Method Summary
protected  void finalize()
          Close the game and chat ports.
 void run()
          Whenever a new client connects to the chat or game ports, create instances of the ChatHandler and ClientHandler subclass respectively and start them.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numberOfGames

public int numberOfGames
Constructor Detail

VoogaDaemon

public VoogaDaemon(int gamePortNumber,
                   int chatPortNumber,
                   int numberOfPlayers,
                   java.lang.String clientHandler)
Static method to return the XML document with the list of games that can be run on the networking Vooga servers.

Parameters:
gamePortNumber - the port through which to send messages related to the game
chatPortNumber - the port through which to send chats
numberOfPlayers - the number of players necessary for the game
clientHandler - the name of the subclass of ClientHandler
Method Detail

run

public void run()
Whenever a new client connects to the chat or game ports, create instances of the ChatHandler and ClientHandler subclass respectively and start them.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

finalize

protected void finalize()
Close the game and chat ports.

Overrides:
finalize in class java.lang.Object