|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.spot.interisolate.InterIsolateServer
public class InterIsolateServer
The purpose of classes in this package is to provide a generic framework for building
remote-procedure-call (RPC) mechanisms between isolates.
The "context" is the object that wishes to provide inter-isolate access to its services.
It doesn't need to know anything about the RPC mechanism.
The "proxy" is the object in the other isolate that wishes to use the context. Many
proxies can access the same context. The context is in a one-to-many relationship with
the proxies. The proxy normally has the same api as the context, or a subset of it (the
subset that needs to be available remotely).
The mechanism uses a ServerChannel for each context. This ServerChannel is created at
startup time, and is given a name that reflects the context being served. E.g.:
InterIsolateServer.run("CONTEXT_ID_STRING", myContext);
RequestSender myRequestSender = RequestSender.lookup("CONTEXT_ID_STRING");
public int doSomething();
public int doSomething() {
ReplyEnvelope reply = myRequestSender.send(new DoSomethingCommand());
resultEnvelope.checkForRuntimeException();
return ((Integer)resultEnvelope.getContents()).intValue();
}
public ReplyEnvelope execute(Object context) {
int result = ((MyContext)context).doSomething();
return new ObjectReplyEnvelope(getUid(), new Integer(result));
}
Method Summary | |
---|---|
static void |
run(String channelName,
Object context)
|
static void |
run(String channelName,
Object context,
int threadPriority)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void run(String channelName, Object context)
public static void run(String channelName, Object context, int threadPriority)
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |