|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.clazzes.remoting.client.Client
public class Client
A remote invocation client, which support callbacks over a single TCP/IP.
Constructor Summary | |
---|---|
Client(java.net.URI uri)
Construct a client, which will connect to the given URI. |
Method Summary | |
---|---|
void |
connect()
Connect to the remote resource. |
void |
deregisterBroadcastHandler(java.lang.String subSystem)
Deregister a broadcast handler previously added with RemoteInvoker.registerBroadcastHandler(String, OneWayHandler) . |
void |
deregisterCallback(java.rmi.server.UID handlerUID)
Deregister a callback previously added with RemoteInvoker.registerCallback(InvocationHandler) . |
void |
disconnect()
Disconnect from the remote resource. |
OneWayHandler |
getBroadcastHandler(java.lang.String subSystem)
Get a broadcast handler previously added with RemoteInvoker.registerBroadcastHandler(String, OneWayHandler) . |
InvocationHandler |
getCallback(java.rmi.server.UID handlerUID)
Get a callback previously added with RemoteInvoker.registerCallback(InvocationHandler) . |
ClientParameters |
getClientParameters()
|
java.rmi.server.UID |
getClientUID()
|
java.util.concurrent.ExecutorService |
getExecutorService()
|
java.lang.ClassLoader |
getMarshalClassLoader()
|
java.lang.Object |
invoke(java.lang.String subSystem,
java.lang.Object arg,
java.util.Map<java.lang.String,java.lang.Object> metadata)
|
boolean |
isConnected()
|
ClassBytes |
loadClass(java.lang.String className)
Request a binary class from the server. |
void |
registerBroadcastHandler(java.lang.String subSystem,
OneWayHandler handler)
|
java.rmi.server.UID |
registerCallback(InvocationHandler handler)
|
void |
setClientParameters(ClientParameters clientParameters)
|
void |
setExecutorService(java.util.concurrent.ExecutorService executorService)
|
void |
setMarshalClassLoader(java.lang.ClassLoader classLoader)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Client(java.net.URI uri) throws java.io.IOException
connect()
.
The following default parameters will be set:
soTimeout | 60000 |
tcpNoDelay | true |
uri
- An URI with a supported scheme. Currently, only the tcp
and ssl
schemes are supported.
java.io.IOException
- If the URI has an unsupported scheme.Method Detail |
---|
public ClientParameters getClientParameters()
setClientParameters(ClientParameters)
,
a new instance of ClientParameters
or SSLClientParameters
is returned
depending on the scheme of the URI passed to the constructor.public void setClientParameters(ClientParameters clientParameters)
clientParameters
- The client parameters to set.public java.lang.ClassLoader getMarshalClassLoader()
setMarshalClassLoader(ClassLoader)
, the context class
loader of the current thread is used.public void setMarshalClassLoader(java.lang.ClassLoader classLoader)
classLoader
- The custom class loader used for resolving deserialized objects.public java.util.concurrent.ExecutorService getExecutorService()
setExecutorService(ExecutorService)
, the result
of Executors.newSingleThreadExecutor()
is returned.public void setExecutorService(java.util.concurrent.ExecutorService executorService)
executorService
- The executor service used to execute the asynchronous reader process.public void connect() throws java.io.IOException
RemoteInvoker
connect
in interface RemoteInvoker
java.io.IOException
public void deregisterCallback(java.rmi.server.UID handlerUID)
RemoteInvoker
RemoteInvoker.registerCallback(InvocationHandler)
.
deregisterCallback
in interface RemoteInvoker
handlerUID
- The handler UID of the callback to deregister as
returned by {RemoteInvoker.registerCallback(InvocationHandler)
.public InvocationHandler getCallback(java.rmi.server.UID handlerUID)
RemoteInvoker
RemoteInvoker.registerCallback(InvocationHandler)
.
getCallback
in interface RemoteInvoker
handlerUID
- The handler UID of the callback to get as
returned by {RemoteInvoker.registerCallback(InvocationHandler)
.public void disconnect()
RemoteInvoker
disconnect
in interface RemoteInvoker
public java.lang.Object invoke(java.lang.String subSystem, java.lang.Object arg, java.util.Map<java.lang.String,java.lang.Object> metadata) throws java.lang.reflect.InvocationTargetException, java.io.IOException
invoke
in interface RemoteInvoker
subSystem
- The subsystem, on which the method is invoked.arg
- The argument passed to the invocation handler.metadata
- The metadata accompanying the remote call, which is passed to the
invocation handler. Metadata may be used to communicate authorization
information such as user/password or a session Id.
java.lang.reflect.InvocationTargetException
- If InvocationHandler.invoke(InvocationContext, Object, Map)
on the server threw an exception. The exception of the server may
be retrieved by InvocationTargetException.getCause()
.
java.io.IOException
- Upon errors in the transport layer-public ClassBytes loadClass(java.lang.String className) throws java.io.IOException
RemoteInvoker
loadClass
in interface RemoteInvoker
className
- The fully qualified name of the class to load.
java.io.IOException
- Upon errors in the transport layer-public boolean isConnected()
isConnected
in interface RemoteInvoker
true
, the server-generated client UID may be
retrieved by InvocationContext.getClientUID()
.public java.rmi.server.UID registerCallback(InvocationHandler handler)
registerCallback
in interface RemoteInvoker
handler
- An invocation handler for the given callback.
public void deregisterBroadcastHandler(java.lang.String subSystem)
RemoteInvoker
RemoteInvoker.registerBroadcastHandler(String, OneWayHandler)
.
deregisterBroadcastHandler
in interface RemoteInvoker
subSystem
- The subsystem for which to deregister a broadcast handler.public void registerBroadcastHandler(java.lang.String subSystem, OneWayHandler handler) throws java.io.IOException
registerBroadcastHandler
in interface RemoteInvoker
subSystem
- The subsystem for which to register a broadcast handler.handler
- A one way invocation handler for the given subsystem.
java.io.IOException
public OneWayHandler getBroadcastHandler(java.lang.String subSystem)
RemoteInvoker
RemoteInvoker.registerBroadcastHandler(String, OneWayHandler)
.
getBroadcastHandler
in interface RemoteInvoker
subSystem
- The subsystem for which to get a broadcast handler.public java.rmi.server.UID getClientUID()
getClientUID
in interface InvocationContext
connect()
. Multiple clients connected
to the same server are guaranteed to have distinct client UIDs.
Return null
, if the client is not connected.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |