|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sapia.ubik.rmi.server.Hub
public class Hub
This class is the single-entry point into Ubik RMI's API.
| Field Summary | |
|---|---|
static ClientRuntime |
clientRuntime
The object implementing client-side behavior |
static ServerRuntime |
serverRuntime
The object implementing server-side behavior |
static StatsCollector |
statsCollector
The stats collector |
static TaskManager |
taskMan
The hub's task manager |
| Constructor Summary | |
|---|---|
Hub()
|
|
| Method Summary | |
|---|---|
static java.lang.Object |
asRemote(java.lang.Object o,
VmId caller,
java.lang.String transportType)
Returns a stub for the given object. |
static RemoteRef |
asRemoteRef(java.lang.Object o,
VmId caller,
java.lang.String transportType)
Returns a remote reference for the given object. |
static java.lang.Object |
connect(ServerAddress address)
This method allows connecting to a RMI server listening on the given address. |
static java.lang.Object |
connect(java.lang.String host,
int port)
This method allows connecting to a RMI server listening to the given host and port. |
static java.lang.Object |
exportObject(java.lang.Object o)
"Exports" the passed in object as a remote RMI server: this method internally starts an RMI server that listens on a random port and implements the interfaces of the passed in object. |
static java.lang.Object |
exportObject(java.lang.Object o,
int port)
This method creates a server listening on the specified port. |
static java.lang.Object |
exportObject(java.lang.Object o,
java.util.Properties props)
Exports the given object as a server (and creates a remote reference). |
static java.lang.Object |
exportObject(java.lang.Object o,
java.lang.String transportType)
Exports the given object as a remote object that will receive request through a server that must already have been exported for the given transport type. |
static ServerAddress |
getServerAddressFor(java.lang.String transportType)
Returns the address of the server for the given transport type. |
static java.lang.Object |
getStubFor(RemoteRef ref,
java.lang.Object remote)
|
static boolean |
isShutdown()
Returns true if the Hub is shut down. |
static void |
shutdown(long timeout)
Shuts down this instance; some part of the shutdown can be asynchronous. |
static java.lang.Object |
toReliableStub(java.lang.Object obj)
Returns a "reliable" stub for the given passed in stub; the dynamically generated proxy (created with Java's reflection API) wraps an InvocationHandler
of the StubHandlerReliable class. |
static java.lang.Object |
toStatelessStub(javax.naming.Name name,
java.lang.String domain,
java.lang.Object obj)
Returns a stateless stub for the given object. |
static java.lang.Object |
toStub(java.lang.Object o)
Generates the stub for the object passed in and returns it. |
static void |
unexport(java.lang.ClassLoader loader)
This method "unexports" all objects whose class was loaded by the given ClassLoader. |
static void |
unexport(java.lang.Object o)
This method "unexports" an object that was exported through one of this class' export() methods. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final StatsCollector statsCollector
public static final TaskManager taskMan
public static final ClientRuntime clientRuntime
public static final ServerRuntime serverRuntime
| Constructor Detail |
|---|
public Hub()
| Method Detail |
|---|
public static java.lang.Object toStub(java.lang.Object o)
throws java.rmi.RemoteException
Object which is the stub of the instance passed in.
java.rmi.RemoteException - if a problem occurs performing the connection.public static java.lang.Object toReliableStub(java.lang.Object obj)
InvocationHandler
of the StubHandlerReliable class.
The object passed as a parameter is expected to be a stub whose invocation handler
is assumed to be of the StubHandlerBasic type. This method thus performs
a stub substitution.
RemoteRefReliable,
RemoteRefEx
public static java.lang.Object toStatelessStub(javax.naming.Name name,
java.lang.String domain,
java.lang.Object obj)
name - the name of the object for which a stateless stub should be returned.domain - the name of the domain to which the object "belongs".obj -
Stateless stub.Stateless
public static java.lang.Object exportObject(java.lang.Object o)
throws java.rmi.RemoteException
java.rmi.RemoteException - if a problem occurs performing the connection.exportObject(Object, int),
connect(String, int)
public static java.lang.Object exportObject(java.lang.Object o,
int port)
throws java.rmi.RemoteException
java.rmi.RemoteException - if a problem occurs performing the connection.exportObject(Object)
public static java.lang.Object exportObject(java.lang.Object o,
java.util.Properties props)
throws java.rmi.RemoteException
The method returns the stub for the given object.
java.rmi.RemoteExceptionTransportManager,
TransportManager.getProviderFor(String),
TransportProvider
public static java.lang.Object exportObject(java.lang.Object o,
java.lang.String transportType)
throws java.rmi.RemoteException
The method returns the stub for the given object.
o - an Object to export.transportType - the identifier of the transport layer to which the given object
will be exported.
java.rmi.RemoteException - if the object could not be exported.public static void unexport(java.lang.Object o)
export() methods. The unexported object will not receive
remote method calls anymore.
NOTE: this method does not stop the server through which the exported instance
is receiving remote method calls. To stop the servers that have been started by
the Hub, call the latter's shutdown() method.
o - the exported object that is to be unexported.shutdown(long)public static void unexport(java.lang.ClassLoader loader)
ClassLoader.
This method can be useful in hot-deploy scenarios.
NOTE: this method does not stop the server through which the exported instances (that
correspond to the given classloader) are receiving remote method calls. To stop the servers that have been started by
the Hub, call the latter's shutdown() method.
loader - shutdown(long)
public static java.lang.Object connect(java.lang.String host,
int port)
throws java.rmi.RemoteException
java.rmi.RemoteException - if a problem occurs performing the connection.
public static java.lang.Object connect(ServerAddress address)
throws java.rmi.RemoteException
address - the ServerAddress corresponding to the target server's
physical endpoint.
java.rmi.RemoteException - if a problem occurs performing the connection.public static ServerAddress getServerAddressFor(java.lang.String transportType)
transportType - the logical identifier of a "transport type".
ServerAddress,
public static java.lang.Object asRemote(java.lang.Object o,
VmId caller,
java.lang.String transportType)
throws java.rmi.RemoteException
o - an object.caller - the VM identifier of the client that triggered the creation
of the returned remote reference.transportType - the "transport type" for which to return a remote reference.
java.rmi.RemoteExceptionasRemoteRef(Object, VmId, String)
public static RemoteRef asRemoteRef(java.lang.Object o,
VmId caller,
java.lang.String transportType)
throws java.rmi.RemoteException
o - an object.caller - the VM identifier of the client that triggered the creation
of the returned remote reference.transportType - the "transport type" for which to return a remote reference.
RemoteRef.
java.rmi.RemoteExceptionpublic static boolean isShutdown()
true if the Hub is shut down.
public static void shutdown(long timeout)
throws java.lang.InterruptedException
timeout - a shutdown "timeout", in millis.
java.lang.InterruptedException
public static java.lang.Object getStubFor(RemoteRef ref,
java.lang.Object remote)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||