org.jboss.remoting
Class Client

java.lang.Object
  extended by org.jboss.remoting.Client
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class Client
extends java.lang.Object
implements java.io.Externalizable

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.

Version:
$Revision: 5166 $
Author:
Jeff Haynie, Tom Elrod, Ovidiu Feodorov
See Also:
Serialized Form

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

ONEWAY_FLAG

public static final java.lang.String ONEWAY_FLAG
Key to be used to determine if invocation is to be oneway (async).

See Also:
Constant Field Values

LISTENER_ID_KEY

public static final java.lang.String LISTENER_ID_KEY
Key to be used when tracking callback listeners.

See Also:
Constant Field Values

MAX_NUM_ONEWAY_THREADS_DEFAULT

public static final int MAX_NUM_ONEWAY_THREADS_DEFAULT
Specifies the default number of work threads in the pool for executing one way invocations on the client. Value is 10.

See Also:
Constant Field Values

RAW

public static final 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. This should be used when want to make direct calls on systems outside of remoting (e.g. making a http POST request to a web service).

See Also:
Constant Field Values

ENABLE_LEASE

public static final 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. The value for this should be either a String that java.lang.Boolean can evaluate or a java.lang.Boolean. Client leasing is turned off by default, so would need to use this property to turn client leasing on.

See Also:
Constant Field Values

HANDSHAKE_COMPLETED_LISTENER

public static final 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.

See Also:
Constant Field Values

CALLBACK_SERVER_PROTOCOL

public static final java.lang.String CALLBACK_SERVER_PROTOCOL
Key for the configuration when adding a callback handler and internal callback server connector is created. The value should be the transport protocol to be used. By default will use the same protocol as being used by this client (e.g. http, socket, rmi, multiplex, etc.)

See Also:
Constant Field Values

CALLBACK_SERVER_HOST

public static final java.lang.String CALLBACK_SERVER_HOST
Key for the configuration when adding a callback handler and internal callback server connector is created. The value should be the host name to be used. By default will use the result of calling InetAddress.getLocalHost().getHostAddress().

See Also:
Constant Field Values

CALLBACK_SERVER_PORT

public static final java.lang.String CALLBACK_SERVER_PORT
Key for the configuration when adding a callback handler and internal callback server connector is created. The value should be the port to be used. By default will find a random unused port.

See Also:
Constant Field Values

MAX_NUM_ONEWAY_THREADS

public static final java.lang.String MAX_NUM_ONEWAY_THREADS
Key for the configuration map that determines the threadpool size for asynchrouous invocations.

See Also:
Constant Field Values

MAX_ONEWAY_THREAD_POOL_QUEUE_SIZE

public static final java.lang.String MAX_ONEWAY_THREAD_POOL_QUEUE_SIZE
Key for the configuration map that determines the queue size for waiting asynchronous invocations.

See Also:
Constant Field Values

DEFAULT_DISCONNECT_TIMEOUT

public static final int DEFAULT_DISCONNECT_TIMEOUT
Default timeout period for network i/o in disconnect() and removeListener(). -1 indicates that no special per invocation timeout will be set.

See Also:
Constant Field Values

THROW_CALLBACK_EXCEPTION

public static final java.lang.String THROW_CALLBACK_EXCEPTION
See Also:
Constant Field Values

USE_ALL_PARAMS

public static final 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.

See Also:
Constant Field Values
Constructor Detail

Client

public 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. Please use other contructors provided.


Client

public Client(InvokerLocator locator)
       throws java.lang.Exception
Constructs a remoting client with intended target server specified via the locator, without specifing a remote subsystem or including any metadata. Same as calling Client(locator, null, null).

Throws:
java.lang.Exception

Client

public Client(InvokerLocator locator,
              java.util.Map configuration)
       throws java.lang.Exception
Constructs a remoting client with intended target server specified via the locator and configuration metadata. The metadata supplied will be used when creating client invoker (in the case specific data is required) and also for passing along additional data to connection listeners on the server side in the case that the client fails, will be able to use this extra information when notified.

Throws:
java.lang.Exception

Client

public Client(InvokerLocator locator,
              java.lang.String subsystem)
       throws java.lang.Exception
Constructs a remoting client with intended target server specified via the locator and intended subsystem on server for invocations to be routed to.

Throws:
java.lang.Exception

Client

public Client(InvokerLocator locator,
              java.lang.String subsystem,
              java.util.Map configuration)
       throws java.lang.Exception
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. The metadata supplied will be used when creating client invoker (in the case specific data is required) and also for passing along additional data to connection listeners on the server side in the case that the client fails, will be able to use this extra information when notified.

Throws:
java.lang.Exception

Client

public Client(java.lang.ClassLoader cl,
              InvokerLocator locator,
              java.lang.String subsystem,
              java.util.Map configuration)
       throws java.lang.Exception
Deprecated. This constructor should not be used any more as will no longer take into account the classloader specified as a parameter.

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. The metadata supplied will be used when creating client invoker (in the case specific data is required) and also for passing along additional data to connection listeners on the server side in the case that the client fails, will be able to use this extra information when notified (which will happen when connect() method is called.

Parameters:
cl - - the classloader that should be used by remoting.
Throws:
java.lang.Exception

Client

public Client(java.lang.ClassLoader cl,
              ClientInvoker invoker,
              java.lang.String subsystem)
       throws java.lang.Exception
Deprecated. This constructor should not be used any more as will no longer take into account the classloader specified as a parameter.

Constructs a remoting client with intended target server specified via the locator and intended subsystem on server for invocations to be routed to.

Throws:
java.lang.Exception
Method Detail

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

addConnectionListener

public 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). The default behavior is to ping for connection every two seconds.


addConnectionListener

public 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). The current behavior is to ping the server periodically. The time period is defined by the pingPeriod (which should be in milliseconds).


addConnectionListener

public 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). The current behavior is to ping the server periodically. Various parameters may be specified in metadata.

See Also:
ConnectionValidator

removeConnectionListener

public boolean removeConnectionListener(ConnectionListener listener)
Removes specified connection listener. Will return true if it has already been registered, false otherwise.


setSessionId

public void setSessionId(java.lang.String sessionId)
This will set the session id used when making invocations on server invokers. There is a default unique id automatically generated for each Client instance, so unless you have a good reason to set this, do not set this.


getConfiguration

public java.util.Map getConfiguration()
Gets the configuration map passed when constructing this object.


getSessionId

public java.lang.String getSessionId()
Gets the session id used when making invocations on server invokers. This is the id that will be used for tracking client connections on the server side, to include client failures that are sent to connection listeners on the server side.


isConnected

public boolean isConnected()
Indicates if the underlying transport has been connected to the target server.


connect

public void connect()
             throws java.lang.Exception
Will cause the underlying transport to make connection to the target server. This is important for any stateful transports, like socket or multiplex. This is also when a client lease with the server is started.

Throws:
java.lang.Exception

connect

public void connect(ConnectionListener listener)
             throws java.lang.Exception
Will cause the underlying transport to make connection to the target server. This is important for any stateful transports, like socket or multiplex. This is also when a client lease with the server is started. If listener is not null, it will be registered to receive a callback if the connection fails.

Throws:
java.lang.Exception

connect

public void connect(ConnectionListener listener,
                    java.util.Map metadata)
             throws java.lang.Exception
Will cause the underlying transport to make connection to the target server. This is important for any stateful transports, like socket or multiplex. This is also when a client lease with the server is started. If listener is not null, it will be registered to receive a callback if the connection fails.

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.

Throws:
java.lang.Exception

disconnect

public void disconnect()
Disconnects the underlying transport from the target server. Also notifies the target server to terminate client lease. Is important that this method is called when no longer using the remoting client. Otherwise resource will not be cleaned up and if the target server requires a lease, it will be maintained in the background.


getInvoker

public ClientInvoker getInvoker()
Get the client invoker (transport implementation).


setInvoker

public void setInvoker(ClientInvoker invoker)
Set the client invoker (transport implementation).


getSubsystem

public java.lang.String getSubsystem()
Gets the subsystem being used when routing invocation request on the server side.


setSubsystem

public void setSubsystem(java.lang.String subsystem)
Sets the subsystem being used when routing invocation requests on the server side. Specifing a subsystem is only needed when server has multiple handlers registered (which will each have their own associated subsystem).


invoke

public java.lang.Object invoke(java.lang.Object param)
                        throws java.lang.Throwable
Invokes the server invoker handler with the payload parameter passed. Same as calling invoke(param, null);

Throws:
java.lang.Throwable

invoke

public java.lang.Object invoke(java.lang.Object param,
                               java.util.Map metadata)
                        throws java.lang.Throwable
Invoke the method remotely.

Parameters:
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.
Throws:
java.lang.Throwable

invokeOneway

public void invokeOneway(java.lang.Object param,
                         java.util.Map sendPayload,
                         boolean clientSide)
                  throws java.lang.Throwable
Will invoke a oneway call to server without a return object. This should be used when not expecting a return value from the server and wish to achieve higher performance, since the client will not wait for a return. This is done one of two ways. The first is to pass true as the clientSide param. This will cause the execution of the remote call to be executed in a new thread on the client side and will return the calling thread before making call to server side. Although, this is optimal for performance, will not know about any problems contacting server.

The second, is to pass false as the clientSide param. This will allow the current calling thread to make the call to the remote server, at which point, the server side processing of the thread will be executed on the remote server in a new executing thread and the client thread will return.

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.

Throws:
java.lang.Throwable

getCallbackConnectors

public java.util.Set getCallbackConnectors(InvokerCallbackHandler callbackHandler)
Returns the callback Connectors with which callbackHandler is registered.


getDisconnectTimeout

public int getDisconnectTimeout()
Gets the timeout used for network i/o in disconnect() and removeListener().


setDisconnectTimeout

public void setDisconnectTimeout(int disconnectTimeout)
Sets the timeout used for network i/o in disconnect() and removeListener().


setMaxOnewayThreadPoolQueueSize

public 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). Default value is MAX_NUM_ONEWAY_THREADS.


getMaxOnewayThreadPoolQueueSize

public 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). Default value is MAX_NUM_ONEWAY_THREADS.


setMaxNumberOfThreads

public 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.


getMaxNumberOfThreads

public 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.


getOnewayThreadPool

public org.jboss.util.threadpool.ThreadPool getOnewayThreadPool()
Gets the thread pool being used for making one way invocations on the client side. If one has not be specifically set via configuration or call to set it, will always return instance of org.jboss.util.threadpool.BasicThreadPool.


setOnewayThreadPool

public void setOnewayThreadPool(org.jboss.util.threadpool.ThreadPool pool)
Sets the thread pool to be used for making one way invocations on the client side.


setSocketFactory

public void setSocketFactory(javax.net.SocketFactory socketFactory)
The socket factory can only be set on the Client before the connect() method has been called. Otherwise, a runtime exception will be thrown.


getSocketFactory

public javax.net.SocketFactory getSocketFactory()

invokeOneway

public void invokeOneway(java.lang.Object param)
                  throws java.lang.Throwable
Same as calling invokeOneway(Object param, Map sendPayload, boolean clientSide) with clientSide param being false and a null sendPayload.

Throws:
java.lang.Throwable

invokeOneway

public void invokeOneway(java.lang.Object param,
                         java.util.Map sendPayload)
                  throws java.lang.Throwable
Same as calling invokeOneway(Object param, Map sendPayload, boolean clientSide) with clientSide param being false.

Throws:
java.lang.Throwable

addListener

public void addListener(InvokerCallbackHandler callbackhandler,
                        java.util.Map metadata)
                 throws java.lang.Throwable
Adds the specified handler as a callback listener for push (async) callbacks. If the transport is uni-directional (e.g. http), remoting will automatically poll for callbacks from the server and deliver them to the callback handler. If the transport is bi-directional (e.g. multiplex), remoting will automatically create a callback server internally and receive and deliver to callback handler the callbacks as they are generated on the server. The metadata map passed will control configuration for how the callbacks are processed, such as the polling frequency.

Throws:
java.lang.Throwable

addListener

public void addListener(InvokerCallbackHandler callbackhandler,
                        java.util.Map metadata,
                        java.lang.Object callbackHandlerObject)
                 throws java.lang.Throwable
Adds the specified handler as a callback listener for push (async) callbacks. If the transport is uni-directional (e.g. http), remoting will automatically poll for callbacks from the server and deliver them to the callback handler. If the transport is bi-directional (e.g. multiplex), remoting will automatically create a callback server internally and receive and deliver to callback handler the callbacks as they are generated on the server. The metadata map passed will control configuration for how the callbacks are processed, such as the polling frequency.

Parameters:
callbackHandlerObject - - this object will be included in the Callback object instance passed to the InvokerCallbackHandler specified.
Throws:
java.lang.Throwable

addListener

public void addListener(InvokerCallbackHandler callbackhandler,
                        java.util.Map metadata,
                        java.lang.Object callbackHandlerObject,
                        boolean serverToClient)
                 throws java.lang.Throwable
Adds the specific handler as a callback listener for async callbacks. If the transport supports bi-directional calls (meaning server can call back to client over same connection that was established by the client) or if the serverToClient flag is set to true, a callback server will be created internally and the target server will actually send callbacks to the client's internal server. Otherwise, the client will simulate push callbacks by internally polling for callbacks on the server and then deliver them to the callback handler.

Parameters:
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.
Throws:
java.lang.Throwable

addListener

public void addListener(InvokerCallbackHandler callbackHandler)
                 throws java.lang.Throwable
Adds the specified handler as a callback listener for pull (sync) callbacks. Using this method will require the programatic getting of callbacks from the server (they will not be pushed to the callback handler automatically).

Throws:
java.lang.Throwable

addListener

public void addListener(InvokerCallbackHandler callbackHandler,
                        InvokerLocator clientLocator)
                 throws java.lang.Throwable
Adds the specified handler as a callback listener for push (async) callbacks. The invoker server will then callback on this handler (via the server invoker specified by the clientLocator) when it gets a callback from the server handler. Note: passing a null clientLocator will cause the client invoker's client locator to be set to null, which basically converts the mode to be pull (sync) where will require call to get callbacks (as will not automatically be pushed to callback handler).

Throws:
java.lang.Throwable

addListener

public void addListener(InvokerCallbackHandler callbackHandler,
                        InvokerLocator clientLocator,
                        java.lang.Object callbackHandlerObject)
                 throws java.lang.Throwable
Adds the specified handler as a callback listener for push (async) callbacks. The invoker server will then callback on this handler (via the server invoker specified by the clientLocator) when it gets a callback from the server handler. Note: passing a null clientLocator will cause the client invoker's client locator to be set to null, which basically converts the mode to be pull (sync) where will require call to get callbacks (as will not automatically be pushed to callback handler).

Parameters:
callbackHandlerObject - will be included in the callback object passed upon callback.
Throws:
java.lang.Throwable

removeListener

public void removeListener(InvokerCallbackHandler callbackHandler)
                    throws java.lang.Throwable
Removes callback handler as a callback listener from the server (and client in the case that it was setup to receive async callbacks). See addListener().

Throws:
java.lang.Throwable

getCallbacks

public java.util.List getCallbacks(InvokerCallbackHandler callbackHandler)
                            throws java.lang.Throwable
Gets the callbacks for specified callback handler. The handler is required because an id is generated for each handler. So if have two callback handlers registered with the same server, no other way to know for which handler to get the callbacks for.

Throws:
java.lang.Throwable

getCallbacks

public java.util.List getCallbacks(InvokerCallbackHandler callbackHandler,
                                   java.util.Map metadata)
                            throws java.lang.Throwable
Gets the callbacks for specified callback handler. The handler is required because an id is generated for each handler. So if have two callback handlers registered with the same server, no other way to know for which handler to get the callbacks for. The metadata map can be used to set callback blocking mode and blocking timeout value.

Throws:
java.lang.Throwable

acknowledgeCallback

public int acknowledgeCallback(InvokerCallbackHandler callbackHandler,
                               Callback callback)
                        throws java.lang.Throwable
Throws:
java.lang.Throwable

acknowledgeCallback

public int acknowledgeCallback(InvokerCallbackHandler callbackHandler,
                               Callback callback,
                               java.lang.Object response)
                        throws java.lang.Throwable
Throws:
java.lang.Throwable

acknowledgeCallbacks

public int acknowledgeCallbacks(InvokerCallbackHandler callbackHandler,
                                java.util.List callbacks)
                         throws java.lang.Throwable
Throws:
java.lang.Throwable

acknowledgeCallbacks

public int acknowledgeCallbacks(InvokerCallbackHandler callbackHandler,
                                java.util.List callbacks,
                                java.util.List responses)
                         throws java.lang.Throwable
Throws:
java.lang.Throwable

setMarshaller

public void setMarshaller(Marshaller marshaller)
Sets the marshaller implementation that should be used by the client invoker (transport). This overrides the client's default marshaller (or any set within configuration).


setUnMarshaller

public void setUnMarshaller(UnMarshaller unmarshaller)
Sets the unmarshaller implementation that should be used by the client invoker (transport). This overrides the client's default unmarshaller (or any set within configuration).


invoke

public java.lang.Object invoke(java.io.InputStream inputStream,
                               java.lang.Object param)
                        throws java.lang.Throwable
Takes an inputstream and wraps a server around. Then calls the target remoting server and passes a proxy for an inputstream to the server's handler. When the server handler calls on this proxy, it will call back on this server wrapped around this inputstream.

Parameters:
param - - invocation payload.
Returns:
the return value from the invocation.
Throws:
java.lang.Throwable

invoke

public java.lang.Object invoke(java.io.InputStream inputStream,
                               java.lang.Object param,
                               Connector streamConnector)
                        throws java.lang.Throwable
Takes an inputstream and wraps a server around. Then calls the target remoting server and passes a proxy for an inputstream to the server's handler. When the server handler calls on this proxy, it will call back on this server wrapped around this inputstream. The Connector passed is expected to have already been started and will have the stream handler added with subsystem of 'stream'. Also note that the Connector passed will not be stopped when/if the server calls to close the input stream.

Parameters:
param - - invocation payload.
Returns:
the return value from the invocation
Throws:
java.lang.Throwable

invoke

public java.lang.Object invoke(java.io.InputStream inputStream,
                               java.lang.Object param,
                               InvokerLocator streamServerLocator)
                        throws java.lang.Throwable
Takes an inputstream and wraps a server around. Then calls the target remoting server and passes proxy for an inputstream to the server's handler. When the server handle calls on this proxy, it will call back on this server wrapped around this inputstream. The InvokerLocator passed is used to create the internal Connector used to receive the calls from the server side.

Throws:
java.lang.Throwable

getPingPeriod

public long getPingPeriod()
Returns:
the ping period (in ms) this client's connection validator is configured with. If the client doesn't ping (on account of connection validator not being installed, or stopped), returns -1.

getLeasePeriod

public long getLeasePeriod()
Returns:
the lease period (in ms) if the client has an active leasing mechanism with the server or -1 otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.