springs.communication.sockets
Class SocketAgentReceiver

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--springs.communication.sockets.SocketAgentReceiver
All Implemented Interfaces:
java.lang.Runnable

public class SocketAgentReceiver
extends java.lang.Thread

An agent receiver implemented using sockets.

Author:
Sergio Ilarri Artigas

Field Summary
(package private)  java.net.ServerSocket _serverSocket
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SocketAgentReceiver(java.net.ServerSocket serverSocket)
          Creates a socket agent receiver.
 
Method Summary
 void run()
          + Run method.
static int startReceiverDaemon()
          This method starts running a daemon to receive new agents.
 
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

_serverSocket

java.net.ServerSocket _serverSocket
Constructor Detail

SocketAgentReceiver

public SocketAgentReceiver(java.net.ServerSocket serverSocket)
                    throws java.io.IOException
Creates a socket agent receiver.

Parameters:
serverSocket - the socket to listen to.
Throws:
java.io.IOException - if error.
See Also:
ServerSocket, IOException
Method Detail

run

public void run()
+ Run method. Creates a serving thread for each incoming agent.

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

startReceiverDaemon

public static int startReceiverDaemon()
                               throws java.io.IOException
This method starts running a daemon to receive new agents.

Returns:
the port number where the daemon will be listening.
Throws:
java.io.IOException - if error.
See Also:
IOException