net.tomp2p.p2p
Class Peer
java.lang.Object
net.tomp2p.p2p.Peer
- Direct Known Subclasses:
- MapReducePeer
public class Peer
- extends Object
TomP2P implements besides the following distributed hash table (DHT)
operations:
- value=get(locationKey)
- put(locationKey,value)
- remove(locationKey)
also the following operations:
- value=get(locationKey,contentKey)
- put(locationKey,contentKey,value)
- remove(locationKey,contentKey)
The advantage of TomP2P is that multiple values can be stored in one
location. Furthermore, TomP2P also provides to store keys in different
domains to avoid key collisions.
- Author:
- Thomas Bocek
Constructor Summary |
Peer(int p2pID,
KeyPair keyPair)
|
Peer(int p2pID,
Number160 nodeId)
|
Peer(int p2pID,
Number160 nodeId,
ConnectionConfigurationBean connectionConfiguration)
|
Peer(int p2pID,
Number160 nodeId,
KeyPair keyPair)
|
Peer(int p2pID,
Number160 nodeId,
P2PConfiguration peerConfiguration,
ConnectionConfigurationBean connectionConfiguration,
KeyPair keyPair)
|
Peer(KeyPair keyPair)
|
Peer(Number160 nodeId)
|
Peer(Number160 nodeId,
KeyPair keyPair)
|
Method Summary |
FutureDHT |
add(Number160 locationKey,
Collection<Data> dataCollection,
ConfigurationStore config)
|
FutureDHT |
add(Number160 locationKey,
Collection<Data> dataCollection,
ConfigurationStore config,
FutureChannelCreator channelCreator)
|
FutureDHT |
add(Number160 locationKey,
Data data)
|
FutureDHT |
add(Number160 locationKey,
Data data,
ConfigurationStore config)
|
FutureDHT |
add(Number160 locationKey,
Data data,
ConfigurationStore config,
FutureChannelCreator channelCreator)
|
ScheduledFuture<?> |
addIndirectReplicaiton(Runnable runnable)
|
void |
addPeerListener(PeerListener listener)
Adds a listener to peer events. |
FutureTracker |
addToTracker(Number160 locationKey,
ConfigurationTrackerStore config)
|
static RequestP2PConfiguration |
adjustConfiguration(RequestP2PConfiguration p2pConfiguration,
PeerMap peerMap)
|
FutureBootstrap |
bootstrap(InetSocketAddress address)
|
FutureBootstrap |
bootstrap(PeerAddress peerAddress)
|
FutureBootstrap |
bootstrap(PeerAddress peerAddress,
Collection<PeerAddress> bootstrapTo,
ConfigurationBootstrap config)
|
FutureBootstrap |
bootstrap(PeerAddress peerAddress,
Collection<PeerAddress> bootstrapTo,
ConfigurationStore config)
Deprecated. |
FutureBootstrap |
bootstrapBroadcast()
|
FutureBootstrap |
bootstrapBroadcast(int port)
|
PeerConnection |
createPeerConnection(PeerAddress destination,
int idleTCPMillis)
Opens a TCP connection and keeps it open. |
void |
customLoggerMessage(String customMessage)
|
FutureDHT |
digest(Number160 locationKey)
|
FutureDHT |
digest(Number160 locationKey,
ConfigurationGet config)
|
FutureDHT |
digest(Number160 locationKey,
ConfigurationGet config,
FutureChannelCreator channelCreator)
|
FutureDHT |
digest(Number160 locationKey,
Set<Number160> keyCollection,
ConfigurationGet config)
|
FutureDHT |
digest(Number160 locationKey,
Set<Number160> keyCollection,
ConfigurationGet config,
FutureChannelCreator channelCreator)
|
FutureDHT |
digestAll(Number160 locationKey)
|
FutureDHT |
digestAll(Number160 locationKey,
ConfigurationGet config)
|
FutureDHT |
digestAll(Number160 locationKey,
ConfigurationGet config,
FutureChannelCreator channelCreator)
|
FutureDiscover |
discover(PeerAddress peerAddress)
Discover attempts to find the external IP address of this peer. |
FutureDHT |
get(Number160 locationKey)
|
FutureDHT |
get(Number160 locationKey,
ConfigurationGet config)
|
FutureDHT |
get(Number160 locationKey,
ConfigurationGet config,
FutureChannelCreator channelCreator)
|
FutureDHT |
get(Number160 locationKey,
Set<Number160> keyCollection,
ConfigurationGet config)
|
FutureDHT |
get(Number160 locationKey,
Set<Number160> keyCollection,
ConfigurationGet config,
FutureChannelCreator channelCreator)
|
FutureDHT |
getAll(Number160 locationKey)
|
FutureDHT |
getAll(Number160 locationKey,
ConfigurationGet config)
|
FutureDHT |
getAll(Number160 locationKey,
ConfigurationGet config,
FutureChannelCreator channelCreator)
|
ConnectionBean |
getConnectionBean()
|
ConnectionConfigurationBean |
getConnectionConfiguration()
|
ConnectionHandler |
getConnectionHandler()
|
DistributedHashHashMap |
getDHT()
|
DirectDataRPC |
getDirectDataRPC()
|
FutureTracker |
getFromTracker(Number160 locationKey,
ConfigurationTrackerGet config)
|
FutureTracker |
getFromTracker(Number160 locationKey,
ConfigurationTrackerGet config,
Set<Number160> knownPeers)
|
FutureTracker |
getFromTrackerCreateBloomfilter1(Number160 locationKey,
ConfigurationTrackerGet config,
Collection<PeerAddress> knownPeers)
|
FutureTracker |
getFromTrackerCreateBloomfilter2(Number160 locationKey,
ConfigurationTrackerGet config,
Collection<Number160> knownPeers)
|
HandshakeRPC |
getHandshakeRPC()
|
P2PConfiguration |
getP2PConfiguration()
|
int |
getP2PID()
|
PeerAddress |
getPeerAddress()
|
PeerBean |
getPeerBean()
|
PeerExchangeRPC |
getPeerExchangeRPC()
|
Number160 |
getPeerID()
|
Map<BaseFuture,Long> |
getPendingFutures()
|
QuitRPC |
getQuitRPC()
|
DistributedRouting |
getRouting()
|
StorageRPC |
getStoreRPC()
|
DistributedTracker |
getTracker()
|
TrackerRPC |
getTrackerRPC()
|
protected void |
init(ConnectionHandler connectionHandler,
Statistics statistics)
|
boolean |
isListening()
|
boolean |
isRunning()
|
void |
listen()
|
void |
listen(File messageLogger)
|
void |
listen(int udpPort,
int tcpPort)
|
void |
listen(int udpPort,
int tcpPort,
Bindings bindings)
|
void |
listen(int udpPort,
int tcpPort,
Bindings bindings,
File messageLogger)
Lets this node listen on a port |
void |
listen(int udpPort,
int tcpPort,
File messageLogger)
|
void |
listen(int udpPort,
int tcpPort,
InetAddress bind)
|
void |
listen(Peer master)
|
FutureDHT |
parallelRequests(Number160 locationKey,
ConfigurationBaseDHT config,
boolean cancleOnFinish,
SortedSet<PeerAddress> queue,
DistributedHashHashMap.Operation operation)
|
FutureDHT |
parallelRequests(Number160 locationKey,
ConfigurationBaseDHT config,
FutureChannelCreator channelCreator,
boolean cancleOnFinish,
SortedSet<PeerAddress> queue,
DistributedHashHashMap.Operation operation)
|
FutureResponse |
ping(InetSocketAddress address)
|
FutureDHT |
put(Number160 locationKey,
Data data)
|
FutureDHT |
put(Number160 locationKey,
Data data,
ConfigurationStore config)
|
FutureDHT |
put(Number160 locationKey,
Data data,
ConfigurationStore config,
FutureChannelCreator channelCreator)
|
FutureDHT |
put(Number160 locationKey,
Map<Number160,Data> dataMap,
ConfigurationStore config)
|
FutureDHT |
put(Number160 locationKey,
Map<Number160,Data> dataMap,
ConfigurationStore config,
FutureChannelCreator channelCreator)
Stores values in the DHT. |
void |
release(ChannelCreator channelCreator)
Release a ChannelCreator. |
FutureDHT |
remove(Number160 locationKey)
|
FutureDHT |
remove(Number160 locationKey,
ConfigurationRemove config)
|
FutureDHT |
remove(Number160 locationKey,
ConfigurationRemove config,
FutureChannelCreator channelCreator)
|
FutureDHT |
remove(Number160 locationKey,
Number160 contentKey)
|
FutureDHT |
remove(Number160 locationKey,
Set<Number160> keyCollection,
ConfigurationRemove config)
|
FutureDHT |
remove(Number160 locationKey,
Set<Number160> keyCollection,
ConfigurationRemove config,
FutureChannelCreator channelCreator)
|
FutureDHT |
removeAll(Number160 locationKey)
|
FutureDHT |
removeAll(Number160 locationKey,
ConfigurationRemove config)
|
FutureDHT |
removeAll(Number160 locationKey,
ConfigurationRemove config,
FutureChannelCreator channelCreator)
|
void |
removePeerListener(PeerListener listener)
Removes a peer listener. |
FutureChannelCreator |
reserve(ConfigurationBaseDHT configurationBaseDHT)
Reserves a connection for a routing and DHT operation. |
FutureChannelCreator |
reserve(ConfigurationBaseDHT configurationBaseDHT,
String name)
Reserves a connection for a routing and DHT operation. |
FutureChannelCreator |
reserve(RoutingConfiguration routingConfiguration,
RequestP2PConfiguration requestP2PConfiguration,
String name)
Reserves a connection for a routing and DHT operation. |
FutureDHT |
send(Number160 locationKey,
org.jboss.netty.buffer.ChannelBuffer buffer)
|
FutureDHT |
send(Number160 locationKey,
org.jboss.netty.buffer.ChannelBuffer buffer,
ConfigurationDirect config)
|
FutureDHT |
send(Number160 locationKey,
org.jboss.netty.buffer.ChannelBuffer buffer,
ConfigurationDirect config,
FutureChannelCreator channelCreator)
|
FutureDHT |
send(Number160 locationKey,
Object object)
|
FutureDHT |
send(Number160 locationKey,
Object object,
ConfigurationDirect config)
|
FutureDHT |
send(Number160 locationKey,
Object object,
ConfigurationDirect config,
FutureChannelCreator channelCreator)
|
FutureData |
send(PeerAddress remotePeer,
org.jboss.netty.buffer.ChannelBuffer requestBuffer)
|
FutureData |
send(PeerAddress remotePeer,
Object object)
|
FutureData |
send(PeerConnection connection,
org.jboss.netty.buffer.ChannelBuffer requestBuffer)
|
FutureData |
send(PeerConnection connection,
Object object)
|
void |
setDefaultStorageReplication()
|
void |
setFutureTimeout(BaseFuture baseFuture,
int millis,
String reason)
Sets a timeout for this future. |
void |
setObjectDataReply(ObjectDataReply objectDataReply)
|
void |
setPeerMap(PeerMap peerMap)
|
void |
setRawDataReply(RawDataReply rawDataReply)
|
void |
setupPortForwanding(String internalHost)
The Dynamic and/or Private Ports are those from 49152 through 65535
(http://www.iana.org/assignments/port-numbers) |
void |
setupPortForwandingUPNP(String internalHost)
Deprecated. |
void |
shutdown()
Closes all connections of this node |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BLOOMFILTER_SIZE
public static final int BLOOMFILTER_SIZE
- See Also:
- Constant Field Values
Peer
public Peer(KeyPair keyPair)
Peer
public Peer(Number160 nodeId)
Peer
public Peer(Number160 nodeId,
KeyPair keyPair)
Peer
public Peer(int p2pID,
KeyPair keyPair)
Peer
public Peer(int p2pID,
Number160 nodeId)
Peer
public Peer(int p2pID,
Number160 nodeId,
KeyPair keyPair)
Peer
public Peer(int p2pID,
Number160 nodeId,
ConnectionConfigurationBean connectionConfiguration)
Peer
public Peer(int p2pID,
Number160 nodeId,
P2PConfiguration peerConfiguration,
ConnectionConfigurationBean connectionConfiguration,
KeyPair keyPair)
addPeerListener
public void addPeerListener(PeerListener listener)
- Adds a listener to peer events. The events being triggered are: startup,
shutdown, change of peer address. The change of the peer address is due
to the discovery process. Since this process runs in an other thread,
this method is thread safe.
- Parameters:
listener
- The listener
removePeerListener
public void removePeerListener(PeerListener listener)
- Removes a peer listener. This method is thread safe.
- Parameters:
listener
- The listener
shutdown
public void shutdown()
- Closes all connections of this node
- Throws:
InterruptedException
listen
public void listen()
throws Exception
- Throws:
Exception
listen
public void listen(File messageLogger)
throws Exception
- Throws:
Exception
listen
public void listen(int udpPort,
int tcpPort)
throws Exception
- Throws:
Exception
listen
public void listen(int udpPort,
int tcpPort,
File messageLogger)
throws Exception
- Throws:
Exception
listen
public void listen(int udpPort,
int tcpPort,
InetAddress bind)
throws Exception
- Throws:
Exception
listen
public void listen(int udpPort,
int tcpPort,
Bindings bindings)
throws Exception
- Throws:
Exception
listen
public void listen(int udpPort,
int tcpPort,
Bindings bindings,
File messageLogger)
throws Exception
- Lets this node listen on a port
- Parameters:
udpPort
- the UDP port to listen ontcpPort
- the TCP port to listen onbindInformation
- contains IP addresses to listen onreplication
- statServer
-
- Throws:
Exception
listen
public void listen(Peer master)
throws Exception
- Throws:
Exception
init
protected void init(ConnectionHandler connectionHandler,
Statistics statistics)
setDefaultStorageReplication
public void setDefaultStorageReplication()
getPendingFutures
public Map<BaseFuture,Long> getPendingFutures()
isRunning
public boolean isRunning()
isListening
public boolean isListening()
customLoggerMessage
public void customLoggerMessage(String customMessage)
getHandshakeRPC
public HandshakeRPC getHandshakeRPC()
getStoreRPC
public StorageRPC getStoreRPC()
getQuitRPC
public QuitRPC getQuitRPC()
getPeerExchangeRPC
public PeerExchangeRPC getPeerExchangeRPC()
getDirectDataRPC
public DirectDataRPC getDirectDataRPC()
getTrackerRPC
public TrackerRPC getTrackerRPC()
getRouting
public DistributedRouting getRouting()
addIndirectReplicaiton
public ScheduledFuture<?> addIndirectReplicaiton(Runnable runnable)
getConnectionHandler
public ConnectionHandler getConnectionHandler()
getDHT
public DistributedHashHashMap getDHT()
getTracker
public DistributedTracker getTracker()
getPeerBean
public PeerBean getPeerBean()
getConnectionBean
public ConnectionBean getConnectionBean()
getPeerID
public Number160 getPeerID()
getPeerAddress
public PeerAddress getPeerAddress()
setPeerMap
public void setPeerMap(PeerMap peerMap)
getP2PID
public int getP2PID()
setRawDataReply
public void setRawDataReply(RawDataReply rawDataReply)
setObjectDataReply
public void setObjectDataReply(ObjectDataReply objectDataReply)
createPeerConnection
public PeerConnection createPeerConnection(PeerAddress destination,
int idleTCPMillis)
- Opens a TCP connection and keeps it open. The user can provide the idle
timeout, which means that the connection gets closed after that time of
inactivity. If the other peer goes offline or closes the connection (due
to inactivity), further requests with this connections reopens the
connection. This methods blocks until a connection can be reserver.
- Parameters:
destination
- The end-point to connect toidleSeconds
- time in seconds after a connection gets closed if
idle, -1 if it should remain always open until the user closes the
connection manually.
- Returns:
- A class that needs to be passed to those methods that should use
the already open connection. If the connection could not be reserved,
maybe due to a shutdown, null is returned.
send
public FutureData send(PeerAddress remotePeer,
org.jboss.netty.buffer.ChannelBuffer requestBuffer)
send
public FutureData send(PeerConnection connection,
org.jboss.netty.buffer.ChannelBuffer requestBuffer)
send
public FutureData send(PeerAddress remotePeer,
Object object)
throws IOException
- Throws:
IOException
send
public FutureData send(PeerConnection connection,
Object object)
throws IOException
- Throws:
IOException
bootstrapBroadcast
public FutureBootstrap bootstrapBroadcast()
bootstrapBroadcast
public FutureBootstrap bootstrapBroadcast(int port)
ping
public FutureResponse ping(InetSocketAddress address)
bootstrap
public FutureBootstrap bootstrap(InetSocketAddress address)
bootstrap
public FutureBootstrap bootstrap(PeerAddress peerAddress)
bootstrap
@Deprecated
public FutureBootstrap bootstrap(PeerAddress peerAddress,
Collection<PeerAddress> bootstrapTo,
ConfigurationStore config)
- Deprecated.
- For backwards compatibility, do not use
- Parameters:
peerAddress
- bootstrapTo
- config
-
- Returns:
bootstrap
public FutureBootstrap bootstrap(PeerAddress peerAddress,
Collection<PeerAddress> bootstrapTo,
ConfigurationBootstrap config)
setupPortForwandingUPNP
@Deprecated
public void setupPortForwandingUPNP(String internalHost)
- Deprecated.
setupPortForwanding
public void setupPortForwanding(String internalHost)
- The Dynamic and/or Private Ports are those from 49152 through 65535
(http://www.iana.org/assignments/port-numbers)
- Parameters:
internalHost
- port
-
discover
public FutureDiscover discover(PeerAddress peerAddress)
- Discover attempts to find the external IP address of this peer. This is
done by first trying to set UPNP with port forwarding (gives us the
external address), query UPNP for the external address, and pinging a
well known peer. The fallback is NAT-PMP
- Parameters:
peerAddress
-
- Returns:
put
public FutureDHT put(Number160 locationKey,
Data data)
put
public FutureDHT put(Number160 locationKey,
Data data,
ConfigurationStore config)
put
public FutureDHT put(Number160 locationKey,
Data data,
ConfigurationStore config,
FutureChannelCreator channelCreator)
put
public FutureDHT put(Number160 locationKey,
Map<Number160,Data> dataMap,
ConfigurationStore config)
put
public FutureDHT put(Number160 locationKey,
Map<Number160,Data> dataMap,
ConfigurationStore config,
FutureChannelCreator channelCreator)
- Stores values in the DHT. First the closest n peers are found, then the
values provided in the dataMap are stored on those peers. A future object
will track the progress since this method returns immediately and the
operations are performed in an other thread.
- Parameters:
locationKey
- The location in the DHTdataMap
- If multiple keys and values are provided, then this method
behaves as putAll()config
- The configuration, which be used to configure the
protection mode, putIfAbsent, and repetitionschannelCreator
- The future channel creator
- Returns:
- The future state of this operation.
add
public FutureDHT add(Number160 locationKey,
Data data)
add
public FutureDHT add(Number160 locationKey,
Data data,
ConfigurationStore config)
add
public FutureDHT add(Number160 locationKey,
Data data,
ConfigurationStore config,
FutureChannelCreator channelCreator)
add
public FutureDHT add(Number160 locationKey,
Collection<Data> dataCollection,
ConfigurationStore config)
add
public FutureDHT add(Number160 locationKey,
Collection<Data> dataCollection,
ConfigurationStore config,
FutureChannelCreator channelCreator)
getAll
public FutureDHT getAll(Number160 locationKey)
getAll
public FutureDHT getAll(Number160 locationKey,
ConfigurationGet config)
getAll
public FutureDHT getAll(Number160 locationKey,
ConfigurationGet config,
FutureChannelCreator channelCreator)
get
public FutureDHT get(Number160 locationKey)
get
public FutureDHT get(Number160 locationKey,
ConfigurationGet config)
get
public FutureDHT get(Number160 locationKey,
ConfigurationGet config,
FutureChannelCreator channelCreator)
get
public FutureDHT get(Number160 locationKey,
Set<Number160> keyCollection,
ConfigurationGet config)
get
public FutureDHT get(Number160 locationKey,
Set<Number160> keyCollection,
ConfigurationGet config,
FutureChannelCreator channelCreator)
parallelRequests
public FutureDHT parallelRequests(Number160 locationKey,
ConfigurationBaseDHT config,
boolean cancleOnFinish,
SortedSet<PeerAddress> queue,
DistributedHashHashMap.Operation operation)
parallelRequests
public FutureDHT parallelRequests(Number160 locationKey,
ConfigurationBaseDHT config,
FutureChannelCreator channelCreator,
boolean cancleOnFinish,
SortedSet<PeerAddress> queue,
DistributedHashHashMap.Operation operation)
digestAll
public FutureDHT digestAll(Number160 locationKey)
digestAll
public FutureDHT digestAll(Number160 locationKey,
ConfigurationGet config)
digestAll
public FutureDHT digestAll(Number160 locationKey,
ConfigurationGet config,
FutureChannelCreator channelCreator)
digest
public FutureDHT digest(Number160 locationKey)
digest
public FutureDHT digest(Number160 locationKey,
ConfigurationGet config)
digest
public FutureDHT digest(Number160 locationKey,
ConfigurationGet config,
FutureChannelCreator channelCreator)
digest
public FutureDHT digest(Number160 locationKey,
Set<Number160> keyCollection,
ConfigurationGet config)
digest
public FutureDHT digest(Number160 locationKey,
Set<Number160> keyCollection,
ConfigurationGet config,
FutureChannelCreator channelCreator)
removeAll
public FutureDHT removeAll(Number160 locationKey)
removeAll
public FutureDHT removeAll(Number160 locationKey,
ConfigurationRemove config)
removeAll
public FutureDHT removeAll(Number160 locationKey,
ConfigurationRemove config,
FutureChannelCreator channelCreator)
remove
public FutureDHT remove(Number160 locationKey)
remove
public FutureDHT remove(Number160 locationKey,
ConfigurationRemove config)
remove
public FutureDHT remove(Number160 locationKey,
ConfigurationRemove config,
FutureChannelCreator channelCreator)
remove
public FutureDHT remove(Number160 locationKey,
Number160 contentKey)
remove
public FutureDHT remove(Number160 locationKey,
Set<Number160> keyCollection,
ConfigurationRemove config)
remove
public FutureDHT remove(Number160 locationKey,
Set<Number160> keyCollection,
ConfigurationRemove config,
FutureChannelCreator channelCreator)
send
public FutureDHT send(Number160 locationKey,
org.jboss.netty.buffer.ChannelBuffer buffer)
send
public FutureDHT send(Number160 locationKey,
org.jboss.netty.buffer.ChannelBuffer buffer,
ConfigurationDirect config)
send
public FutureDHT send(Number160 locationKey,
org.jboss.netty.buffer.ChannelBuffer buffer,
ConfigurationDirect config,
FutureChannelCreator channelCreator)
send
public FutureDHT send(Number160 locationKey,
Object object)
throws IOException
- Throws:
IOException
send
public FutureDHT send(Number160 locationKey,
Object object,
ConfigurationDirect config)
throws IOException
- Throws:
IOException
send
public FutureDHT send(Number160 locationKey,
Object object,
ConfigurationDirect config,
FutureChannelCreator channelCreator)
throws IOException
- Throws:
IOException
getFromTracker
public FutureTracker getFromTracker(Number160 locationKey,
ConfigurationTrackerGet config)
getFromTrackerCreateBloomfilter1
public FutureTracker getFromTrackerCreateBloomfilter1(Number160 locationKey,
ConfigurationTrackerGet config,
Collection<PeerAddress> knownPeers)
getFromTrackerCreateBloomfilter2
public FutureTracker getFromTrackerCreateBloomfilter2(Number160 locationKey,
ConfigurationTrackerGet config,
Collection<Number160> knownPeers)
getFromTracker
public FutureTracker getFromTracker(Number160 locationKey,
ConfigurationTrackerGet config,
Set<Number160> knownPeers)
addToTracker
public FutureTracker addToTracker(Number160 locationKey,
ConfigurationTrackerStore config)
getConnectionConfiguration
public ConnectionConfigurationBean getConnectionConfiguration()
getP2PConfiguration
public P2PConfiguration getP2PConfiguration()
adjustConfiguration
public static RequestP2PConfiguration adjustConfiguration(RequestP2PConfiguration p2pConfiguration,
PeerMap peerMap)
reserve
public FutureChannelCreator reserve(ConfigurationBaseDHT configurationBaseDHT,
String name)
- Reserves a connection for a routing and DHT operation. This call blocks
until connections have been reserved.
- Parameters:
configurationBaseDHT
- The information about the routing and the DHT
operationname
- The name of the ChannelCreator, used for easier debugging
- Returns:
- A ChannelCreator that can create channel according to
routingConfiguration and requestP2PConfiguration
reserve
public FutureChannelCreator reserve(ConfigurationBaseDHT configurationBaseDHT)
- Reserves a connection for a routing and DHT operation. This call blocks
until connections have been reserved.
- Parameters:
configurationBaseDHT
- The information about the routing and the DHT
operation
- Returns:
- A ChannelCreator that can create channel according to
routingConfiguration and requestP2PConfiguration
reserve
public FutureChannelCreator reserve(RoutingConfiguration routingConfiguration,
RequestP2PConfiguration requestP2PConfiguration,
String name)
- Reserves a connection for a routing and DHT operation. This call blocks
until connections have been reserved. At least one of the arguments
routingConfiguration or requestP2PConfiguration must not be null.
- Parameters:
routingConfiguration
- The information about the routingrequestP2PConfiguration
- The information about the DHT operationname
- The name of the ChannelCreator, used for easier debugging
- Returns:
- A ChannelCreator that can create channel according to
routingConfiguration and requestP2PConfiguration
- Throws:
IllegalArgumentException
- If both arguments routingConfiguration
and requestP2PConfiguration are null
release
public void release(ChannelCreator channelCreator)
- Release a ChannelCreator. The permits will be returned so that they can
be used again. This is a wrapper for ConnectionReservation.
- Parameters:
channelCreator
- The ChannelCreator that is not used anymore
setFutureTimeout
public void setFutureTimeout(BaseFuture baseFuture,
int millis,
String reason)
- Sets a timeout for this future. If the timeout passes, the future fails
with the reason provided
- Parameters:
baseFuture
- The future to set the timeoutmillis
- The time in milliseconds until this future is considered a
failure.reason
- The reason why this future failed
Copyright © 2012. All Rights Reserved.