public class Hub extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_TRANSPORT_TYPE |
| Constructor and Description |
|---|
Hub() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
connect(ServerAddress address)
This method allows connecting to a RMI server listening on the given address.
|
static Object |
connect(String host,
int port)
This method allows connecting to a RMI server listening to the given host
and port.
|
static Object |
exportObject(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 Object |
exportObject(Object o,
int port)
This method creates a server listening on the specified port.
|
static Object |
exportObject(Object object,
Properties props)
Exports the given object as a server (and creates a remote reference).
|
static Object |
exportObject(Object object,
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 Modules |
getModules() |
static ServerAddress |
getServerAddressFor(String transportType)
Returns the address of the server for the given transport type.
|
static boolean |
isShutdown()
Returns true if the Hub is shut down.
|
static void |
refresh(ServerAddress address)
Forces the clearing of the connection pool corresponding to the given address.
|
static void |
shutdown()
Shuts down this instance.
|
static void |
shutdown(long timeout)
Shuts down this instance; some part of the shutdown can be asynchronous.
|
static void |
unexport(ClassLoader loader)
This method "unexports" all objects whose class was loaded by the given
ClassLoader. |
static void |
unexport(Object o)
This method "unexports" an object that was exported through one of this
class'
export() methods. |
public static final String DEFAULT_TRANSPORT_TYPE
public static Object exportObject(Object o) throws RemoteException
RemoteException - if a problem occurs performing the connection.exportObject(Object, int),
connect(String, int)public static Object exportObject(Object o, int port) throws RemoteException
RemoteException - if a problem occurs performing the connection.exportObject(Object)public static Object exportObject(Object object, Properties props) throws RemoteException
The method returns the stub for the given object.
object - the Object to export.props - the transport provider Properties.RemoteExceptionTransportManager,
TransportManager.getProviderFor(String),
TransportProviderpublic static Object exportObject(Object object, String transportType) throws RemoteException
The method returns the stub for the given object.
object - an Object to export.transportType - the identifier of the transport layer to which the given object
will be exported.RemoteException - if the object could not be exported.public static void unexport(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
this class, call the latter's shutdown() method.
o - the exported object that is to be unexported.shutdown(long)public static void unexport(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 Object connect(String host, int port) throws RemoteException
RemoteException - if a problem occurs performing the connection.public static Object connect(ServerAddress address) throws RemoteException
address - the ServerAddress corresponding to the target server's
physical endpoint.RemoteException - if a problem occurs performing the connection.public static void refresh(ServerAddress address)
address - a ServerAddressConnections.clear()public static ServerAddress getServerAddressFor(String transportType)
transportType - the logical identifier of a "transport type".ServerAddress,public static boolean isShutdown()
true if the Hub is shut down.public static void shutdown()
public static void shutdown(long timeout)
throws InterruptedException
timeout - a shutdown "timeout", in millis.InterruptedExceptionCopyright © 2012 Sapia OSS. All Rights Reserved.