- All Implemented Interfaces:
- java.lang.Comparable<java.util.concurrent.Delayed>, java.util.concurrent.Delayed, java.util.concurrent.Future<V>, jsr166y.ForkJoinPool.ManagedBlocker
public class RPC<V extends DTask>
extends java.lang.Object
implements java.util.concurrent.Future<V>, java.util.concurrent.Delayed, jsr166y.ForkJoinPool.ManagedBlocker
A remotely executed FutureTask. Flow is:
1- Build a DTask (or subclass). This object will be replicated remotely.
2- Make a RPC object, naming the target Node. Call (re)call(). Call get()
to block for result, or cancel() or isDone(), etc. Caller can also arrange
for caller.tryComplete() to be called in a F/J thread, to support completion
style execution (i.e. Continuation Passing Style).
3- DTask will be serialized and sent to the target; small objects via UDP
and large via TCP (using AutoBuffer and auto-gen serializers).
4- An RPC UDP control packet will be sent to target; this will also contain
the DTask if its small enough.
4.5- The network may replicate (or drop) the UDP packet. Dups may arrive.
4.5- Sender may timeout, and send dup control UDP packets.
5- Target will capture a UDP packet, and begin filtering dups (via task#).
6- Target will deserialize the DTask, and call DTask.invoke() in a F/J thread.
6.5- Target continues to filter (and drop) dup UDP sends (and timeout resends)
7- Target finishes call, and puts result in DTask.
8- Target serializes result and sends to back to sender.
9- Target sends an ACK back (may be combined with the result if small enough)
10- Target puts the ACK in H2ONode.TASKS for later filtering.
10.5- Target receives dup UDP request, then replies with ACK back.
11- Sender receives ACK result; deserializes; notifies waiters
12- Sender sends ACKACK back
12.5- Sender recieves dup ACK's, sends dup ACKACK's back
13- Target recieves ACKACK, removes TASKS tracking