|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sentilla.net.rpc.RemoteInvoker
public class RemoteInvoker
RemoteInvoker manages an RPC transaction between a caller and callee(s). Construct RemoteInvoker with a sender for the destination motes, and a result_factory for the response to be sent by the callee back to the caller. Then, send and invoke the procedure on the callees with one of the invoke routines. invoke(procedure, result_type) returns a single result. invokeMany(procedure, result_type, maxResults, timeoutMilli) returns multiple results through an iterable abstraction. If the remote procedure returns an exception instead of providing results, the exception is returned and thrown back at the caller.
Nested Class Summary | |
---|---|
protected class |
RemoteInvoker.ResultIter<T>
|
Field Summary |
---|
Fields inherited from interface com.sentilla.system.Action |
---|
DONE, ERROR, IDLE, PENDING |
Constructor Summary | |
---|---|
RemoteInvoker(Sender sender,
SenderFactory result_factory)
Create a new RemoteInvoker for a particular sender and result path. |
Method Summary | ||
---|---|---|
Action |
block()
Block an indefinite amount of time until this Action is no longer pending. |
|
Action |
block(int timeoutMilli)
Block a defined amount of time or until the Action is no longer pending. |
|
Action |
cancel()
Cancel this Action if PENDING. |
|
byte |
getActionState()
Get the current state of this Action: IDLE, PENDING, DONE, or ERROR. |
|
Procedure |
getProcedure()
|
|
Receiver |
getReceiver()
|
|
Object |
getResult()
|
|
|
getResult(Class<T> result_type)
|
|
|
getResultMany(Class<T> result_type,
int maxResults,
int timeoutMilli)
|
|
Sender |
getSender()
|
|
|
invoke(Procedure<T> procedure,
Class<T> result_type)
Remotely invoke a procedure and return a single result. |
|
|
invoke(Procedure<T> procedure,
Class<T> result_type,
int timeoutMilli)
Remotely invoke a procedure and return a single result. |
|
|
invokeMany(Procedure<T> procedure,
Class<T> result_type,
int maxResults,
int timeoutMilli)
Remotely invoke a procedure and return an iterable over possibly many results. |
|
boolean |
isDone()
Return true is this Action is DONE. |
|
RemoteInvoker |
setProcedure(Procedure procedure)
|
|
RemoteInvoker |
setSender(Sender sender)
|
|
Action |
submit()
Submit this Action for processing by the action engine. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RemoteInvoker(Sender sender, SenderFactory result_factory)
Method Detail |
---|
public <T> T invoke(Procedure<T> procedure, Class<T> result_type)
procedure
- instance of Procedure to executeresult_type
- result type to expect
public <T> T invoke(Procedure<T> procedure, Class<T> result_type, int timeoutMilli)
procedure
- instance of Procedure to executeresult_type
- result type to expecttimeoutMilli
- milliseconds to wait for return result
public <T> Iterable<Result<T>> invokeMany(Procedure<T> procedure, Class<T> result_type, int maxResults, int timeoutMilli)
public RemoteInvoker setProcedure(Procedure procedure)
public RemoteInvoker setSender(Sender sender)
public Procedure getProcedure()
public Sender getSender()
public Receiver getReceiver()
public Object getResult()
public <T> T getResult(Class<T> result_type)
public <T> Iterable<Result<T>> getResultMany(Class<T> result_type, int maxResults, int timeoutMilli)
public Action submit()
Action
submit
in interface Action
public Action block() throws ActionException
Action
block
in interface Action
ActionException
public Action block(int timeoutMilli) throws ActionException
Action
block
in interface Action
timeoutMilli
- the maximum number of milliseconds to block
ActionException
public Action cancel()
Action
cancel
in interface Action
public byte getActionState()
Action
getActionState
in interface Action
public boolean isDone() throws ActionException
Action
isDone
in interface Action
ActionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |