ucr.core
Class IncomingConnectionManager

java.lang.Object
  extended byjava.lang.Thread
      extended byucr.core.ConnectionManager
          extended byucr.core.IncomingConnectionManager
All Implemented Interfaces:
java.lang.Runnable

class IncomingConnectionManager
extends ConnectionManager

Manager for incomming connections


Field Summary
protected  ConnectionData connectionData
           
protected  ConnectionList connectionList
           
private  HostCache hostCache
           
protected  Router router
           
private  java.net.ServerSocket serverSocket
           
protected  boolean shutdown
           
private static int SOCKET_RETRY_COUNT
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
(package private) IncomingConnectionManager(Router router, ConnectionList connectionList, ConnectionData connectionData, HostCache hostCache)
          Constructs the incoming connection manager
 
Method Summary
 void closeServerSocket()
           
(package private)  java.net.ServerSocket createServerSocket()
          Creates a ServerSocket using an alternate port if needed
(package private)  ConnectionList getConnectionList()
          Gets the list of connections
(package private)  int getDesiredConnectionCount()
          Get the desired connection count
(package private)  boolean isShutdown()
          Check if the manager is shut down
 void openServerSocket()
           
 void run()
          Main processing loop for serversocket
(package private)  void setDesiredConnectionCount(int count)
          Set the desired connection count
(package private)  void shutdown()
          Closes all connections and stops processing
 
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

SOCKET_RETRY_COUNT

private static final int SOCKET_RETRY_COUNT
See Also:
Constant Field Values

serverSocket

private java.net.ServerSocket serverSocket

hostCache

private HostCache hostCache

connectionList

protected ConnectionList connectionList

shutdown

protected boolean shutdown

connectionData

protected ConnectionData connectionData

router

protected Router router
Constructor Detail

IncomingConnectionManager

IncomingConnectionManager(Router router,
                          ConnectionList connectionList,
                          ConnectionData connectionData,
                          HostCache hostCache)
                    throws java.io.IOException
Constructs the incoming connection manager

Method Detail

openServerSocket

public void openServerSocket()

closeServerSocket

public void closeServerSocket()

createServerSocket

java.net.ServerSocket createServerSocket()
                                   throws java.io.IOException
Creates a ServerSocket using an alternate port if needed

Returns:
socket
Throws:
java.io.IOException - if socket creation fails

run

public void run()
Main processing loop for serversocket


setDesiredConnectionCount

void setDesiredConnectionCount(int count)
Set the desired connection count

Parameters:
count - desired connection count

getDesiredConnectionCount

int getDesiredConnectionCount()
Get the desired connection count

Returns:
desired connection count

shutdown

void shutdown()
Closes all connections and stops processing


isShutdown

boolean isShutdown()
Check if the manager is shut down

Returns:
true if shut down, false otherwise

getConnectionList

ConnectionList getConnectionList()
Gets the list of connections

Returns:
connection list