cz.cuni.pogamut.Parser
Class RemoteParserServer

java.lang.Object
  extended by cz.cuni.pogamut.Parser.RemoteParserServer
All Implemented Interfaces:
java.lang.Runnable

public class RemoteParserServer
extends java.lang.Object
implements java.lang.Runnable

This class is instantiated by RemoteParser to listen on a specific port and accepting client connections.


Nested Class Summary
private  class RemoteParserServer.MediatorStorage
           
 
Field Summary
private  java.util.logging.Logger clientLog
           
private  int exception
           
private  java.net.URI gbUri
           
private  UnrealIDMap idMap
           
private  java.util.logging.Logger log
           
static int MAX_IO_EXCEPTIONS_SEQUENCE
           
private  java.util.ArrayList<RemoteParserServer.MediatorStorage> runningClients
           
private  java.net.ServerSocket socket
           
private  boolean terminating
           
private  Flag<java.lang.Boolean> threadAlive
          Flag which tells us wether threadIsAlive - initialize the flag at the beggining of the run() and drops it as the last command of the run().
 
Constructor Summary
RemoteParserServer(int port, java.net.URI gbUri, java.util.logging.Logger log)
           
 
Method Summary
private  boolean exceptionReachedLimit()
           
private  void initClientLog()
           
private  void initNewClient(java.net.Socket clientSocket)
          Init new mediator / parser for a client identified by the socket.
 void run()
           
private  void stopEverything()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_IO_EXCEPTIONS_SEQUENCE

public static final int MAX_IO_EXCEPTIONS_SEQUENCE
See Also:
Constant Field Values

threadAlive

private Flag<java.lang.Boolean> threadAlive
Flag which tells us wether threadIsAlive - initialize the flag at the beggining of the run() and drops it as the last command of the run(). We assume that you may have only one thread running with one instance of the class.


socket

private java.net.ServerSocket socket

gbUri

private java.net.URI gbUri

log

private java.util.logging.Logger log

clientLog

private java.util.logging.Logger clientLog

idMap

private UnrealIDMap idMap

exception

private int exception

runningClients

private java.util.ArrayList<RemoteParserServer.MediatorStorage> runningClients

terminating

private boolean terminating
Constructor Detail

RemoteParserServer

public RemoteParserServer(int port,
                          java.net.URI gbUri,
                          java.util.logging.Logger log)
                   throws java.io.IOException
Throws:
java.io.IOException
Method Detail

initClientLog

private void initClientLog()

stopEverything

private void stopEverything()

initNewClient

private void initNewClient(java.net.Socket clientSocket)
                    throws ConnectException,
                           java.io.IOException
Init new mediator / parser for a client identified by the socket. Exceptions: UnknownHostException -> can't resolve GameBots address ConnectException -> can't connect to GameBots IOException -> communication error

Parameters:
clientSocket -
Throws:
ConnectException
java.io.IOException

exceptionReachedLimit

private boolean exceptionReachedLimit()

run

public void run()
Specified by:
run in interface java.lang.Runnable