|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.remoting.Client
public class 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 int |
DEFAULT_DISCONNECT_TIMEOUT
Default timeout period for network i/o in disconnect() and removeListener(). |
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 java.lang.String |
MAX_NUM_ONEWAY_THREADS
Key for the configuration map that determines the threadpool size for asynchrouous invocations. |
static int |
MAX_NUM_ONEWAY_THREADS_DEFAULT
Specifies the default number of work threads in the pool for executing one way invocations on the client. |
static java.lang.String |
MAX_ONEWAY_THREAD_POOL_QUEUE_SIZE
Key for the configuration map that determines the queue size for waiting asynchronous invocations. |
static java.lang.String |
ONEWAY_FLAG
Key to be used to determine if invocation is to be oneway (async). |
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. |
static java.lang.String |
THROW_CALLBACK_EXCEPTION
|
static java.lang.String |
USE_ALL_PARAMS
The key to use to specify that parameters for objects created by Client should be taken, in addition to the metadata map, from the InvokerLocator and from the Client's configuration map. |
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 locator, 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 | |
---|---|
int |
acknowledgeCallback(InvokerCallbackHandler callbackHandler,
Callback callback)
|
int |
acknowledgeCallback(InvokerCallbackHandler callbackHandler,
Callback callback,
java.lang.Object response)
|
int |
acknowledgeCallbacks(InvokerCallbackHandler callbackHandler,
java.util.List callbacks)
|
int |
acknowledgeCallbacks(InvokerCallbackHandler callbackHandler,
java.util.List callbacks,
java.util.List responses)
|
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 |
addConnectionListener(ConnectionListener listener,
java.util.Map metadata)
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 |
connect(ConnectionListener listener)
Will cause the underlying transport to make connection to the target server. |
void |
connect(ConnectionListener listener,
java.util.Map metadata)
Will cause the underlying transport to make connection to the target server. |
void |
disconnect()
Disconnects the underlying transport from the target server. |
java.util.Set |
getCallbackConnectors(InvokerCallbackHandler callbackHandler)
Returns the callback Connectors with which callbackHandler is registered. |
java.util.List |
getCallbacks(InvokerCallbackHandler callbackHandler)
Gets the callbacks for specified callback handler. |
java.util.List |
getCallbacks(InvokerCallbackHandler callbackHandler,
java.util.Map metadata)
Gets the callbacks for specified callback handler. |
java.util.Map |
getConfiguration()
Gets the configuration map passed when constructing this object. |
int |
getDisconnectTimeout()
Gets the timeout used for network i/o in disconnect() and removeListener(). |
ClientInvoker |
getInvoker()
Get the client invoker (transport implementation). |
long |
getLeasePeriod()
|
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). |
int |
getMaxOnewayThreadPoolQueueSize()
Gets the maximum queue size 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). |
org.jboss.util.threadpool.ThreadPool |
getOnewayThreadPool()
Gets the thread pool being used for making one way invocations on the client side. |
long |
getPingPeriod()
|
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 |
setDisconnectTimeout(int disconnectTimeout)
Sets the timeout used for network i/o in disconnect() and removeListener(). |
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). |
void |
setMaxOnewayThreadPoolQueueSize(int maxOnewayThreadPoolQueueSize)
Sets the maximum queue size 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). |
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). |
java.lang.String |
toString()
|
void |
writeExternal(java.io.ObjectOutput out)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ONEWAY_FLAG
public static final java.lang.String LISTENER_ID_KEY
public static final int MAX_NUM_ONEWAY_THREADS_DEFAULT
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
public static final java.lang.String MAX_NUM_ONEWAY_THREADS
public static final java.lang.String MAX_ONEWAY_THREAD_POOL_QUEUE_SIZE
public static final int DEFAULT_DISCONNECT_TIMEOUT
public static final java.lang.String THROW_CALLBACK_EXCEPTION
public static final java.lang.String USE_ALL_PARAMS
Constructor Detail |
---|
public Client()
public Client(InvokerLocator locator) throws java.lang.Exception
java.lang.Exception
public Client(InvokerLocator locator, java.util.Map configuration) throws java.lang.Exception
java.lang.Exception
public Client(InvokerLocator locator, java.lang.String subsystem) throws java.lang.Exception
java.lang.Exception
public Client(InvokerLocator locator, java.lang.String subsystem, java.util.Map configuration) throws java.lang.Exception
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 remoting.
java.lang.Exception
public Client(java.lang.ClassLoader cl, ClientInvoker invoker, java.lang.String subsystem) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
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
public void addConnectionListener(ConnectionListener listener)
public void addConnectionListener(ConnectionListener listener, int pingPeriod)
public void addConnectionListener(ConnectionListener listener, java.util.Map metadata)
ConnectionValidator
public boolean removeConnectionListener(ConnectionListener listener)
public void setSessionId(java.lang.String 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 connect(ConnectionListener listener) throws java.lang.Exception
java.lang.Exception
public void connect(ConnectionListener listener, java.util.Map metadata) throws java.lang.Exception
If this version of connect() is used, and leasing is enabled, the concept of "connection identity" is enforced. That is, the ConnectionValidator used by this Client will be tied to the LeasePinger currently used by the MicroRemoteClientInvoker created or reused in this method, and that LeasePinger will be tied to this Client and its ConnectionValidator. If the ConnectionValidator used by any of the Clients associated with the MicroRemoteClientInvoker used by this Client detects a broken connection, it will shut down that LeasePinger. Moreover, each ConnectionValidator associated with that LeasePinger will notify its ConnectionListeners of the broken connection. At that point, the LeasePinger will be destroyed, and all of the associated Clients will be disconnected.
java.lang.Exception
public void disconnect()
public ClientInvoker getInvoker()
public void setInvoker(ClientInvoker invoker)
public java.lang.String getSubsystem()
public void setSubsystem(java.lang.String subsystem)
public java.lang.Object invoke(java.lang.Object param) throws java.lang.Throwable
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 handler.metadata
- - 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
NOTE: The treatment of server side oneway invocations may vary with the transport. The client side transport is not required to wait for a reply from the server. In particular, the socket and bisocket transports return immediately after writing the invocation.
java.lang.Throwable
public java.util.Set getCallbackConnectors(InvokerCallbackHandler callbackHandler)
public int getDisconnectTimeout()
public void setDisconnectTimeout(int disconnectTimeout)
public void setMaxOnewayThreadPoolQueueSize(int maxOnewayThreadPoolQueueSize)
public int getMaxOnewayThreadPoolQueueSize()
public void setMaxNumberOfThreads(int numOfThreads)
public int getMaxNumberOfThreads()
public org.jboss.util.threadpool.ThreadPool getOnewayThreadPool()
public void setOnewayThreadPool(org.jboss.util.threadpool.ThreadPool pool)
public void setSocketFactory(javax.net.SocketFactory socketFactory)
public javax.net.SocketFactory getSocketFactory()
public void invokeOneway(java.lang.Object param) throws java.lang.Throwable
java.lang.Throwable
public void invokeOneway(java.lang.Object param, java.util.Map sendPayload) throws java.lang.Throwable
java.lang.Throwable
public void addListener(InvokerCallbackHandler callbackhandler, java.util.Map metadata) throws java.lang.Throwable
java.lang.Throwable
public void addListener(InvokerCallbackHandler callbackhandler, java.util.Map metadata, java.lang.Object callbackHandlerObject) throws java.lang.Throwable
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
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
java.lang.Throwable
public void addListener(InvokerCallbackHandler callbackHandler, InvokerLocator clientLocator) throws java.lang.Throwable
java.lang.Throwable
public void addListener(InvokerCallbackHandler callbackHandler, InvokerLocator clientLocator, java.lang.Object callbackHandlerObject) throws java.lang.Throwable
callbackHandlerObject
- will be included in the callback object passed upon callback.
java.lang.Throwable
public void removeListener(InvokerCallbackHandler callbackHandler) throws java.lang.Throwable
java.lang.Throwable
public java.util.List getCallbacks(InvokerCallbackHandler callbackHandler) throws java.lang.Throwable
java.lang.Throwable
public java.util.List getCallbacks(InvokerCallbackHandler callbackHandler, java.util.Map metadata) throws java.lang.Throwable
java.lang.Throwable
public int acknowledgeCallback(InvokerCallbackHandler callbackHandler, Callback callback) throws java.lang.Throwable
java.lang.Throwable
public int acknowledgeCallback(InvokerCallbackHandler callbackHandler, Callback callback, java.lang.Object response) throws java.lang.Throwable
java.lang.Throwable
public int acknowledgeCallbacks(InvokerCallbackHandler callbackHandler, java.util.List callbacks) throws java.lang.Throwable
java.lang.Throwable
public int acknowledgeCallbacks(InvokerCallbackHandler callbackHandler, java.util.List callbacks, java.util.List responses) throws java.lang.Throwable
java.lang.Throwable
public void setMarshaller(Marshaller marshaller)
public void setUnMarshaller(UnMarshaller unmarshaller)
public java.lang.Object invoke(java.io.InputStream inputStream, java.lang.Object param) throws java.lang.Throwable
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
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
java.lang.Throwable
public long getPingPeriod()
public long getLeasePeriod()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |