ucr.core
Class ConnectionList

java.lang.Object
  extended byucr.core.ConnectionList

public class ConnectionList
extends java.lang.Object

Contains the set of current connections, the node connections can be in different states, not all may be active


Field Summary
private  java.util.List currentConnectionList
           
 
Constructor Summary
(package private) ConnectionList()
           
 
Method Summary
(package private)  void addConnection(NodeConnection connection)
          Adds a connection
(package private)  int cleanDeadConnections(int type)
          Remove any dead connections from the list
(package private)  boolean contains(Host host)
          Check if a connection exists to a host
(package private)  boolean contains(java.lang.String ipAddress)
          Check if a connection exists to a host
(package private)  int getActiveConnectionCount(int type)
          Gets a count of the active (running outgoing connections)
(package private)  java.util.List getActiveConnections()
          Get active outgoing and incoming connections
private  java.util.List getActiveConnections(int type)
          Gets the active outgoing connections
 int getActiveIncomingConnectionCount()
          Get the count of active incoming connections
(package private)  java.util.List getActiveIncomingConnections()
          Gets the active incoming connections
 int getActiveOutgoingConnectionCount()
          Gets a count of the active (running outgoing connections)
(package private)  java.util.List getActiveOutgoingConnections()
          Gets the active outgoing connections
 java.util.LinkedList getList()
          Gets a list containing the connections
 java.util.LinkedList getListOutgoing()
           
(package private)  void removeConnection(NodeConnection connection)
          Removes a connection
(package private)  void stopALLConnectionNOW()
          Shuts down non-running connections needed
(package private)  void stopOutgoingConnectionAttempts()
          Shuts down non-running connections needed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentConnectionList

private java.util.List currentConnectionList
Constructor Detail

ConnectionList

ConnectionList()
Method Detail

getList

public java.util.LinkedList getList()
Gets a list containing the connections

Returns:
list of connections

getListOutgoing

public java.util.LinkedList getListOutgoing()

addConnection

void addConnection(NodeConnection connection)
Adds a connection

Parameters:
connection - new connection

removeConnection

void removeConnection(NodeConnection connection)
Removes a connection

Parameters:
connection - to remove

contains

boolean contains(java.lang.String ipAddress)
Check if a connection exists to a host

Parameters:
ipAddress - host address
Returns:
true if a connection exists to this IP address

contains

boolean contains(Host host)
Check if a connection exists to a host

Parameters:
host - which contains ip and port
Returns:
true if a connection exists to this IP address

getActiveConnections

java.util.List getActiveConnections()
Get active outgoing and incoming connections

Returns:
active connections

getActiveOutgoingConnections

java.util.List getActiveOutgoingConnections()
Gets the active outgoing connections

Returns:
list of connections

getActiveIncomingConnections

java.util.List getActiveIncomingConnections()
Gets the active incoming connections

Returns:
active list

getActiveConnections

private java.util.List getActiveConnections(int type)
Gets the active outgoing connections

Returns:
list of connections

getActiveOutgoingConnectionCount

public int getActiveOutgoingConnectionCount()
Gets a count of the active (running outgoing connections)

Returns:
count

getActiveIncomingConnectionCount

public int getActiveIncomingConnectionCount()
Get the count of active incoming connections

Returns:
count

getActiveConnectionCount

int getActiveConnectionCount(int type)
Gets a count of the active (running outgoing connections)

Returns:
count

cleanDeadConnections

int cleanDeadConnections(int type)
Remove any dead connections from the list

Parameters:
type - of collection to clean
Returns:
number of live connections remaining

stopOutgoingConnectionAttempts

void stopOutgoingConnectionAttempts()
Shuts down non-running connections needed


stopALLConnectionNOW

void stopALLConnectionNOW()
Shuts down non-running connections needed