|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.remoting.Client
Client is a convience class for invoking remote methods for a given subsystem. It is intended to be the main user interface for making remote invocation on the client side.
Field Summary | |
static java.lang.String |
CALLBACK_SERVER_HOST
Key for the configuration when adding a callback handler and internal callback server connector is created. |
static java.lang.String |
CALLBACK_SERVER_PORT
Key for the configuration when adding a callback handler and internal callback server connector is created. |
static java.lang.String |
CALLBACK_SERVER_PROTOCOL
Key for the configuration when adding a callback handler and internal callback server connector is created. |
static java.lang.String |
ENABLE_LEASE
Key for the configuration map passed to the Client constructor to indicate that client should make initial request to establish lease with server. |
static java.lang.String |
HANDSHAKE_COMPLETED_LISTENER
Key for the configuration map passed to the Client constructor providing a ssl javax.net.ssl.HandshakeCompletedListener implementation, which will be called on when ssl handshake completed with server. |
static java.lang.String |
LISTENER_ID_KEY
Key to be used when tracking callback listeners. |
static int |
MAX_NUM_ONEWAY_THREADS
Specifies the default number of work threads in the pool for executing one way invocations on the client. |
static java.lang.String |
RAW
The key to use for the metadata Map passed when making a invoke() call and wish for the invocation payload to be sent as is and not wrapped within a remoting invocation request object. |
Constructor Summary | |
Client()
PLEASE DO NOT USE THIS CONSTRUCTOR OR YOUR COMPUTER WILL BURST INTO FLAMES!!! It is only here so can externalize object and will provide a dead object if invoker is not explicitly set. |
|
Client(java.lang.ClassLoader cl,
ClientInvoker invoker,
java.lang.String subsystem)
Deprecated. This constructor should not be used any more as will no longer take into account the classloader specified as a parameter. |
|
Client(java.lang.ClassLoader cl,
InvokerLocator locator,
java.lang.String subsystem,
java.util.Map configuration)
Deprecated. This constructor should not be used any more as will no longer take into account the classloader specified as a parameter. |
|
Client(InvokerLocator locator)
Constructs a remoting client with intended target server specified via the lcoator, without specifing a remote subsystem or including any metadata. |
|
Client(InvokerLocator locator,
java.util.Map configuration)
Constructs a remoting client with intended target server specified via the locator and configuration metadata. |
|
Client(InvokerLocator locator,
java.lang.String subsystem)
Constructs a remoting client with intended target server specified via the locator and intended subsystem on server for invocations to be routed to. |
|
Client(InvokerLocator locator,
java.lang.String subsystem,
java.util.Map configuration)
Constructs a remoting client with intended target server specified via the locator, intended subsystem on the server for invocations to be routed to, and configuration metadata. |
Method Summary | |
void |
addConnectionListener(ConnectionListener listener)
Adds a connection listener that will be notified if/when the connection to the server fails while the client is idle (no calls being made). |
void |
addConnectionListener(ConnectionListener listener,
int pingPeriod)
Adds a connection listener that will be notified if/when the connection to the server fails while the client is idle (no calls being made). |
void |
addListener(InvokerCallbackHandler callbackHandler)
Adds the specified handler as a callback listener for pull (sync) callbacks. |
void |
addListener(InvokerCallbackHandler callbackHandler,
InvokerLocator clientLocator)
Adds the specified handler as a callback listener for push (async) callbacks. |
void |
addListener(InvokerCallbackHandler callbackHandler,
InvokerLocator clientLocator,
java.lang.Object callbackHandlerObject)
Adds the specified handler as a callback listener for push (async) callbacks. |
void |
addListener(InvokerCallbackHandler callbackhandler,
java.util.Map metadata)
Adds the specified handler as a callback listener for push (async) callbacks. |
void |
addListener(InvokerCallbackHandler callbackhandler,
java.util.Map metadata,
java.lang.Object callbackHandlerObject)
Adds the specified handler as a callback listener for push (async) callbacks. |
void |
addListener(InvokerCallbackHandler callbackhandler,
java.util.Map metadata,
java.lang.Object callbackHandlerObject,
boolean serverToClient)
Adds the specific handler as a callback listener for async callbacks. |
void |
connect()
Will cause the underlying transport to make connection to the target server. |
void |
disconnect()
Disconnects the underlying transport from the target server. |
java.util.List |
getCallbacks(InvokerCallbackHandler callbackHandler)
Gets the callbacks for specified callback handler. |
java.util.Map |
getConfiguration()
Gets the configuration map passed when constructing this object. |
ClientInvoker |
getInvoker()
Get the client invoker (transport implementation). |
int |
getMaxNumberOfThreads()
Gets the maximum number of threads to use within client pool for one way invocations on the client side (meaning oneway invocation is handled by thread in this pool and user's call returns immediately) Default value is MAX_NUM_ONEWAY_THREADS. |
org.jboss.util.threadpool.ThreadPool |
getOnewayThreadPool()
Gets the thread pool being used for making one way invocations on the client side. |
java.lang.String |
getSessionId()
Gets the session id used when making invocations on server invokers. |
javax.net.SocketFactory |
getSocketFactory()
|
java.lang.String |
getSubsystem()
Gets the subsystem being used when routing invocation request on the server side. |
java.lang.Object |
invoke(java.io.InputStream inputStream,
java.lang.Object param)
Takes an inputstream and wraps a server around. |
java.lang.Object |
invoke(java.io.InputStream inputStream,
java.lang.Object param,
Connector streamConnector)
Takes an inputstream and wraps a server around. |
java.lang.Object |
invoke(java.io.InputStream inputStream,
java.lang.Object param,
InvokerLocator streamServerLocator)
Takes an inputstream and wraps a server around. |
java.lang.Object |
invoke(java.lang.Object param)
Invokes the server invoker handler with the payload parameter passed. |
java.lang.Object |
invoke(java.lang.Object param,
java.util.Map metadata)
invoke the method remotely |
void |
invokeOneway(java.lang.Object param)
Same as calling invokeOneway(Object param, Map sendPayload, boolean clientSide) with clientSide param being false and a null sendPayload. |
void |
invokeOneway(java.lang.Object param,
java.util.Map sendPayload)
Same as calling invokeOneway(Object param, Map sendPayload, boolean clientSide) with clientSide param being false. |
void |
invokeOneway(java.lang.Object param,
java.util.Map sendPayload,
boolean clientSide)
Will invoke a oneway call to server without a return object. |
boolean |
isConnected()
Indicates if the underlying transport has been connected to the target server. |
void |
readExternal(java.io.ObjectInput in)
|
boolean |
removeConnectionListener(ConnectionListener listener)
Removes specified connection listener. |
void |
removeListener(InvokerCallbackHandler callbackHandler)
Removes callback handler as a callback listener from the server (and client in the case that it was setup to receive async callbacks). |
void |
setInvoker(ClientInvoker invoker)
Set the client invoker (transport implementation) |
void |
setMarshaller(Marshaller marshaller)
Sets the marshaller implementation that should be used by the client invoker (transport). |
void |
setMaxNumberOfThreads(int numOfThreads)
Sets the maximum number of threads to use within client pool for one way invocations on the client side (meaning oneway invocation is handled by thread in this pool and user's call returns immediately) Default value is MAX_NUM_ONEWAY_THREADS. |
void |
setOnewayThreadPool(org.jboss.util.threadpool.ThreadPool pool)
Sets the thread pool to be used for making one way invocations on the client side. |
void |
setSessionId(java.lang.String sessionId)
This will set the session id used when making invocations on server invokers. |
void |
setSocketFactory(javax.net.SocketFactory socketFactory)
The socket factory can only be set on the Client before the connect() method has been called. |
void |
setSubsystem(java.lang.String subsystem)
Sets the subsystem being used when routing invocation requests on the server side. |
void |
setUnMarshaller(UnMarshaller unmarshaller)
Sets the unmarshaller implementation that should be used by the client invoker (transport). |
void |
writeExternal(java.io.ObjectOutput out)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String LISTENER_ID_KEY
public static final int MAX_NUM_ONEWAY_THREADS
public static final java.lang.String RAW
public static final java.lang.String ENABLE_LEASE
public static final java.lang.String HANDSHAKE_COMPLETED_LISTENER
public static final java.lang.String CALLBACK_SERVER_PROTOCOL
public static final java.lang.String CALLBACK_SERVER_HOST
public static final java.lang.String CALLBACK_SERVER_PORT
Constructor Detail |
public Client(InvokerLocator locator) throws java.lang.Exception
locator
-
java.lang.Exception
public Client(InvokerLocator locator, java.util.Map configuration) throws java.lang.Exception
locator
- configuration
-
java.lang.Exception
public Client(InvokerLocator locator, java.lang.String subsystem) throws java.lang.Exception
locator
- subsystem
-
java.lang.Exception
public Client(InvokerLocator locator, java.lang.String subsystem, java.util.Map configuration) throws java.lang.Exception
locator
- subsystem
- configuration
-
java.lang.Exception
public Client(java.lang.ClassLoader cl, InvokerLocator locator, java.lang.String subsystem, java.util.Map configuration) throws java.lang.Exception
cl
- - the classloader that should be used by remotinglocator
- subsystem
- configuration
-
java.lang.Exception
public Client(java.lang.ClassLoader cl, ClientInvoker invoker, java.lang.String subsystem) throws java.lang.Exception
cl
- invoker
- subsystem
-
java.lang.Exception
public Client()
Method Detail |
public void addConnectionListener(ConnectionListener listener)
listener
- public void addConnectionListener(ConnectionListener listener, int pingPeriod)
listener
- public boolean removeConnectionListener(ConnectionListener listener)
listener
-
public void setSessionId(java.lang.String sessionId)
sessionId
- public java.util.Map getConfiguration()
public java.lang.String getSessionId()
public boolean isConnected()
public void connect() throws java.lang.Exception
java.lang.Exception
public void disconnect()
public ClientInvoker getInvoker()
public void setInvoker(ClientInvoker invoker)
invoker
- public java.lang.String getSubsystem()
public void setSubsystem(java.lang.String subsystem)
subsystem
- public java.lang.Object invoke(java.lang.Object param) throws java.lang.Throwable
param
-
java.lang.Throwable
public java.lang.Object invoke(java.lang.Object param, java.util.Map metadata) throws java.lang.Throwable
param
- - payload for the server invoker handlermetadata
- - any extra metadata that may be needed by the transport (i.e. GET or POST if using
http invoker) or if need to pass along extra data to the server invoker handler.
java.lang.Throwable
public void invokeOneway(java.lang.Object param, java.util.Map sendPayload, boolean clientSide) throws java.lang.Throwable
param
- sendPayload
- clientSide
-
java.lang.Throwable
public void setMaxNumberOfThreads(int numOfThreads)
numOfThreads
- public int getMaxNumberOfThreads()
public org.jboss.util.threadpool.ThreadPool getOnewayThreadPool()
public void setOnewayThreadPool(org.jboss.util.threadpool.ThreadPool pool)
pool
- public void setSocketFactory(javax.net.SocketFactory socketFactory)
socketFactory
- public javax.net.SocketFactory getSocketFactory()
public void invokeOneway(java.lang.Object param) throws java.lang.Throwable
param
-
java.lang.Throwable
public void invokeOneway(java.lang.Object param, java.util.Map sendPayload) throws java.lang.Throwable
param
- sendPayload
-
java.lang.Throwable
public void addListener(InvokerCallbackHandler callbackhandler, java.util.Map metadata) throws java.lang.Throwable
callbackhandler
- metadata
-
java.lang.Throwable
public void addListener(InvokerCallbackHandler callbackhandler, java.util.Map metadata, java.lang.Object callbackHandlerObject) throws java.lang.Throwable
callbackhandler
- metadata
- callbackHandlerObject
- this object will be included in the Callback object instance passed
to the InvokerCallbackHandler specified.
java.lang.Throwable
public void addListener(InvokerCallbackHandler callbackhandler, java.util.Map metadata, java.lang.Object callbackHandlerObject, boolean serverToClient) throws java.lang.Throwable
callbackhandler
- metadata
- callbackHandlerObject
- serverToClient
- if true, will allow server to connect to the client directly (which must
be allowed by firewall in front of client unless transport is bi-directional, such as the multiplex transport).
If false (and not bi-directional transport), server will not create any new connection to the client.
java.lang.Throwable
public void addListener(InvokerCallbackHandler callbackHandler) throws java.lang.Throwable
callbackHandler
-
java.lang.Throwable
public void addListener(InvokerCallbackHandler callbackHandler, InvokerLocator clientLocator) throws java.lang.Throwable
callbackHandler
- clientLocator
-
java.lang.Throwable
public void addListener(InvokerCallbackHandler callbackHandler, InvokerLocator clientLocator, java.lang.Object callbackHandlerObject) throws java.lang.Throwable
callbackHandler
- interface to call on with callbackclientLocator
- locator for callback server to callback oncallbackHandlerObject
- will be included in the callback object passed upon callback
java.lang.Throwable
public void removeListener(InvokerCallbackHandler callbackHandler) throws java.lang.Throwable
callbackHandler
-
java.lang.Throwable
public java.util.List getCallbacks(InvokerCallbackHandler callbackHandler) throws java.lang.Throwable
callbackHandler
-
java.lang.Throwable
public void setMarshaller(Marshaller marshaller)
marshaller
- public void setUnMarshaller(UnMarshaller unmarshaller)
unmarshaller
- public java.lang.Object invoke(java.io.InputStream inputStream, java.lang.Object param) throws java.lang.Throwable
inputStream
- param
- invocation payload
java.lang.Throwable
public java.lang.Object invoke(java.io.InputStream inputStream, java.lang.Object param, Connector streamConnector) throws java.lang.Throwable
inputStream
- param
- invocation payload
java.lang.Throwable
public java.lang.Object invoke(java.io.InputStream inputStream, java.lang.Object param, InvokerLocator streamServerLocator) throws java.lang.Throwable
inputStream
- param
- streamServerLocator
-
java.lang.Throwable
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |