|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.p2p.multiring.MultiringEndpoint
public class MultiringEndpoint
Field Summary | |
---|---|
protected Application |
application
The application this endpoint is for |
protected Endpoint |
endpoint
The node which this mulitring node is wrapping |
protected MultiringNode |
node
The multiring node supporting this endpoint |
Constructor Summary | |
---|---|
protected |
MultiringEndpoint(MultiringNode node,
Endpoint endpoint,
Application application)
Constructor |
Method Summary | |
---|---|
void |
accept(AppSocketReceiver receiver)
Set's the acceptor for this application. |
NodeHandle |
coalesce(NodeHandle handle)
|
void |
connect(NodeHandle handle,
AppSocketReceiver receiver,
int timeout)
Passthrough to sub endpoint. |
protected void |
deliver(RingId id,
Message target)
Internal method which delivers the message to the application |
MessageDeserializer |
getDeserializer()
Returns the deserializer. |
Environment |
getEnvironment()
Returns the environment. |
Id |
getId()
Returns this node's id, which is its identifier in the namespace. |
java.lang.String |
getInstance()
Returns a unique instance name of this endpoint, sort of a mailbox name for this application. |
NodeHandle |
getLocalNodeHandle()
Returns a handle to the local node below this endpoint. |
boolean |
isAlive(NodeHandle nh)
|
NodeHandleSet |
localLookup(Id id,
int num,
boolean safe)
This call produces a list of nodes that can be used as next hops on a route towards the given id, such that the resulting route satisfies the overlay protocol's bounds on the number of hops taken. |
NodeHandleSet |
neighborSet(int num)
This methods returns an unordered set of nodehandles on which are neighbors of the local node in the id space. |
java.util.List<NodeHandle> |
networkNeighbors(int num)
Returns an ordered list of the nearest known neighbors. |
void |
process(Executable task,
Continuation command)
Schedules a job for processing on the dedicated processing thread. |
int |
proximity(NodeHandle nh)
This replaces NodeHandle.proximity(), so that you don't have to have a "coalesced" NodeHandle. |
IdRange |
range(NodeHandle handle,
int rank,
Id lkey)
This operation provides information about ranges of keys for which the node is currently a rank-root. |
IdRange |
range(NodeHandle handle,
int rank,
Id lkey,
boolean cumulative)
This operation provides information about ranges of keys for which the node is currently a rank-root. |
Id |
readId(InputBuffer buf,
short type)
To use a more efficient serialization format than Java Serialization |
IdRange |
readIdRange(InputBuffer buf)
To use Raw Serialization |
NodeHandle |
readNodeHandle(InputBuffer buf)
To use Raw Serialization |
NodeHandleSet |
readNodeHandleSet(InputBuffer buf,
short type)
|
void |
register()
Call this after you have set up your Endpoint: called setDeserializer(), called accept(). |
NodeHandleSet |
replicaSet(Id id,
int maxRank)
This methods returns an ordered set of nodehandles on which replicas of an object with a given id can be stored. |
NodeHandleSet |
replicaSet(Id id,
int maxRank,
NodeHandle root,
NodeHandleSet set)
This methods returns an ordered set of nodehandles on which replicas of an object with a given id can be stored. |
MessageReceipt |
route(Id id,
Message message,
NodeHandle hint)
This method makes an attempt to route the message to the root of the given id. |
MessageReceipt |
route(Id id,
Message message,
NodeHandle hint,
DeliveryNotification deliverAckToMe)
|
MessageReceipt |
route(Id id,
Message message,
NodeHandle hint,
DeliveryNotification deliverAckToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
This method makes an attempt to route the message to the root of the given id. |
MessageReceipt |
route(Id id,
RawMessage message,
NodeHandle hint)
|
MessageReceipt |
route(Id id,
RawMessage message,
NodeHandle hint,
DeliveryNotification deliverAckToMe)
|
MessageReceipt |
route(Id id,
RawMessage message,
NodeHandle hint,
DeliveryNotification deliverAckToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Same as the other call, but uses the Raw serialization rather than java serialization. |
boolean |
routingConsistentFor(Id id)
Can we guarantee that this id is currently ours, and routing will be consistent? Note that this has some real timing implications, so don't cache the returned value. |
CancellableTask |
scheduleMessage(Message message,
long delay)
Schedules a message to be delivered to this application after the provided number of milliseconds. |
CancellableTask |
scheduleMessage(Message message,
long delay,
long period)
Schedules a message to be delivered to this application every period number of milliseconds, after delay number of miliseconds have passed. |
CancellableTask |
scheduleMessageAtFixedRate(Message message,
long delay,
long period)
Schedules a message to be delivered to this application every period number of milliseconds, after delay number of miliseconds have passed. |
void |
setConsistentRouting(boolean val)
default value is true Consistent routing causes RouteMessages to be dropped if we are not sure that we are responsible for our current id range. |
void |
setDeserializer(MessageDeserializer md)
To use a more efficient serialization format than Java Serialization |
void |
setSendOptions(java.util.Map<java.lang.String,java.lang.Object> options)
Uses these options as defaults. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected MultiringNode node
protected Application application
protected Endpoint endpoint
Constructor Detail |
---|
protected MultiringEndpoint(MultiringNode node, Endpoint endpoint, Application application)
node
- The node to base this node off ofMethod Detail |
---|
public Id getId()
getId
in interface Endpoint
public MessageReceipt route(Id id, Message message, NodeHandle hint)
route
in interface Endpoint
id
- The destination Id of the message.message
- The message to deliverhint
- The first node to send this message to, optionalpublic MessageReceipt route(Id id, Message message, NodeHandle hint, DeliveryNotification deliverAckToMe)
route
in interface Endpoint
public MessageReceipt route(Id id, Message message, NodeHandle hint, DeliveryNotification deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
Endpoint
route
in interface Endpoint
id
- The destination Id of the message.message
- The message to deliverhint
- The first node to send this message to, optionaldeliverAckToMe
- notified when the message is sent
public MessageReceipt route(Id id, RawMessage message, NodeHandle hint)
route
in interface Endpoint
public MessageReceipt route(Id id, RawMessage message, NodeHandle hint, DeliveryNotification deliverAckToMe)
route
in interface Endpoint
public MessageReceipt route(Id id, RawMessage message, NodeHandle hint, DeliveryNotification deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
Endpoint
route
in interface Endpoint
public NodeHandleSet localLookup(Id id, int num, boolean safe)
localLookup
in interface Endpoint
id
- The destination id.num
- The number of nodes to return.safe
- Whether or not to return safe nodes.public NodeHandleSet neighborSet(int num)
neighborSet
in interface Endpoint
num
- The number of desired handle to return.public NodeHandleSet replicaSet(Id id, int maxRank)
replicaSet
in interface Endpoint
id
- The object's id.maxRank
- The number of desired replicas.public NodeHandleSet replicaSet(Id id, int maxRank, NodeHandle root, NodeHandleSet set)
replicaSet
in interface Endpoint
id
- The object's id.maxRank
- The number of desired replicas.handle
- The root handle of the remove setset
- The set of other nodes around the root handlepublic IdRange range(NodeHandle handle, int rank, Id lkey)
range
in interface Endpoint
handle
- The handle whose range to check.rank
- The root rank.lkey
- An "index" in case of multiple ranges.public IdRange range(NodeHandle handle, int rank, Id lkey, boolean cumulative)
range
in interface Endpoint
handle
- The handle whose range to check.rank
- The root rank.lkey
- An "index" in case of multiple ranges.cumulative
- Whether to return the cumulative or single rangepublic NodeHandle getLocalNodeHandle()
getLocalNodeHandle
in interface Endpoint
public CancellableTask scheduleMessage(Message message, long delay)
scheduleMessage
in interface Endpoint
message
- The message to be delivereddelay
- The number of milliseconds to wait before delivering the messagepublic CancellableTask scheduleMessage(Message message, long delay, long period)
scheduleMessage
in interface Endpoint
message
- The message to be delivereddelay
- The number of milliseconds to wait before delivering the fist messagedelay
- The number of milliseconds to wait before delivering subsequent messagespublic CancellableTask scheduleMessageAtFixedRate(Message message, long delay, long period)
Endpoint
scheduleMessageAtFixedRate
in interface Endpoint
message
- The message to be delivereddelay
- The number of milliseconds to wait before delivering the fist messagepublic java.util.List<NodeHandle> networkNeighbors(int num)
Endpoint
networkNeighbors
in interface Endpoint
public void process(Executable task, Continuation command)
process
in interface Endpoint
task
- The task to run on the processing threadcommand
- The command to return the result to once it's doneprotected void deliver(RingId id, Message target)
id
- The target idmessage
- The message to deliverpublic java.lang.String getInstance()
getInstance
in interface Endpoint
public Environment getEnvironment()
Endpoint
getEnvironment
in interface Endpoint
public void connect(NodeHandle handle, AppSocketReceiver receiver, int timeout)
connect
in interface Endpoint
receiver
- calls receiveSocket() when a new AppSocket is opened to this application
on a remote node.public void accept(AppSocketReceiver receiver)
Endpoint
accept
in interface Endpoint
receiver
- calls receiveSocket() when a new AppSocket is opened to this application
from a remote node.
Note that you must call accept() again after each socket is received to properly handle
socket backloggingpublic void setDeserializer(MessageDeserializer md)
Endpoint
setDeserializer
in interface Endpoint
public MessageDeserializer getDeserializer()
Endpoint
getDeserializer
in interface Endpoint
public Id readId(InputBuffer buf, short type) throws java.io.IOException
Endpoint
readId
in interface Endpoint
java.io.IOException
public NodeHandle readNodeHandle(InputBuffer buf) throws java.io.IOException
NodeHandleReader
readNodeHandle
in interface Endpoint
readNodeHandle
in interface NodeHandleReader
java.io.IOException
public IdRange readIdRange(InputBuffer buf) throws java.io.IOException
Endpoint
readIdRange
in interface Endpoint
java.io.IOException
public NodeHandle coalesce(NodeHandle handle)
coalesce
in interface NodeHandleReader
public NodeHandleSet readNodeHandleSet(InputBuffer buf, short type) throws java.io.IOException
readNodeHandleSet
in interface Endpoint
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public void register()
Endpoint
register
in interface Endpoint
public int proximity(NodeHandle nh)
Endpoint
proximity
in interface Endpoint
public boolean isAlive(NodeHandle nh)
isAlive
in interface Endpoint
public void setConsistentRouting(boolean val)
Endpoint
setConsistentRouting
in interface Endpoint
public boolean routingConsistentFor(Id id)
Endpoint
routingConsistentFor
in interface Endpoint
public void setSendOptions(java.util.Map<java.lang.String,java.lang.Object> options)
Endpoint
setSendOptions
in interface Endpoint
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |