rice.pastry.wire
Class GlobalSocketManager
java.lang.Object
rice.pastry.wire.SocketManager
rice.pastry.wire.GlobalSocketManager
- All Implemented Interfaces:
- SelectionKeyHandler
- public class GlobalSocketManager
- extends SocketManager
This is one of the first steps toward a centrally managed
wire protocol that can support OS level limitations such
as FileDescriptor limits. This object has static lists
of the sockets open to other connections. This way such
a list is maintained process wide since the number of
FDs is a per-process count.
Method Summary |
protected java.util.LinkedList |
generateOpenSockets()
Returns the staticlly allocated list. |
protected boolean |
needToDisconnectSockets()
asks the socketmanager wether to call
removeOpenSocketsIfNeeded |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GlobalSocketManager
public GlobalSocketManager(WirePastryNode node,
int port,
java.nio.channels.Selector selector)
- Constructs a new GlobalSocketManager.
- Parameters:
node
- The pastry node this manager is servingport
- The port number which this manager is listening onselector
- The Selector this manager should register with
generateOpenSockets
protected java.util.LinkedList generateOpenSockets()
- Returns the staticlly allocated list.
- Overrides:
generateOpenSockets
in class SocketManager
- Returns:
- a LinkedList to remember what sockets are open
needToDisconnectSockets
protected boolean needToDisconnectSockets()
- asks the socketmanager wether to call
removeOpenSocketsIfNeeded
- Overrides:
needToDisconnectSockets
in class SocketManager
- Returns:
- wether to disconnect some sockets