|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface IRemoteMessenger
Very similar to RMI
Objects can be registered with a remote messenger under a public name and
declared to implement a particular interface. Methods on this registered
object can then be called on different vms.
To call a method on the registered object, you get a remote reference to it using the
getRemote(...) method. This returns an object that can be used and called
as if it were the original implementor.
The getRemote(...) method though may be called on a different vm than
the registerRemote(...) method. In that case the calls on the return value of
getRemote(...) will be routed to the implementor object passed to registerRemote(...)
On VM A you have code like
RemoteName FOO = new RemoteName("Foo", IFoo.class);
IFoo aFoo = new Foo();
aRemoteMessenger.registerRemote(IFoo.class, aFoo, FOO);
After this runs, on VM B you can do
IFoo someFoo = anotherRemoteMessenger.getRemote(FOO); boolean rVal = someFoo.fee(); if(rVal) ...What will happen is that the fee() call in VM B will be invoked on aFoo in VM A.
Remotes and threading
Remotes are multithreaded. Method calls may arrive out of order that methods were called.
IRemote, java.lang.reflect.Proxy| Method Summary | |
|---|---|
IRemote |
getRemote(RemoteName name)
|
boolean |
hasLocalImplementor(RemoteName name)
|
boolean |
isServer()
|
void |
registerRemote(java.lang.Object implementor,
RemoteName name)
|
void |
unregisterRemote(RemoteName name)
Remove the remote registered under name. |
void |
unregisterRemote(java.lang.String name)
Remove the remote registered under name. |
| Method Detail |
|---|
IRemote getRemote(RemoteName name)
name - the name the remote is registered under.
void registerRemote(java.lang.Object implementor,
RemoteName name)
remoteInterface - - the remote interface that implementor implements,
must be a subclass of IRemoteimplementor - - an object that implements remoteInterfacename - - the name that implementor will be registered undervoid unregisterRemote(java.lang.String name)
void unregisterRemote(RemoteName name)
boolean hasLocalImplementor(RemoteName name)
boolean isServer()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||