Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.remoting
Class Client

    java.lang.Object
      org.jboss.remoting.Client

public class Client
extends Object

Client is a convience method for invoking remote methods for a given subsystem

Version:
  $Revision: 1.10 $
Author:
  Jeff Haynie, Tom Elrod

Field Summary
`static int` | `MAX_NUM_ONEWAY_THREADS` Indicated the max number of threads used within oneway thread pool.

Constructor Summary
`Client(ClassLoader cl, ClientInvoker invoker, String subsystem)`
`Client(ClassLoader cl, InvokerLocator locator, String subsystem)`
`Client(InvokerLocator locator, String subsystem)`

Method Summary
`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` | `connect()`
`void` | `disconnect()`
`List` | `getCallbacks()`
`ClientInvoker` | `getInvoker()`
`String` | `getSessionId()`
`String` | `getSubsystem()`
`Object` | `invoke(Object param, Map sendPayload)` invoke the method remotely
`void` | `invokeOneway(Object param, Map sendPayload)` Same as calling invokeOneway(Object param, Map sendPayload, boolean clientSide) with clientSide param being false.
`void` | `invokeOneway(Object param, Map sendPayload, boolean clientSide)` Will invoke a oneway call to server without a return object.
`boolean` | `isConnected()`
`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)`
`void` | `setSessionId(String sessionId)` This will set the session id used when making invocations on server invokers.
`void` | `setSubsystem(String subsystem)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MAX_NUM_ONEWAY_THREADS

    public static final int MAX_NUM_ONEWAY_THREADS

  Indicated the max number of threads used within oneway thread pool.

  See Also:
    Constant Field Values

Constructor Detail

### Client

    public Client(InvokerLocator locator,
                  String subsystem)
           throws Exception

### Client

    public Client(ClassLoader cl,
                  InvokerLocator locator,
                  String subsystem)
           throws Exception

### Client

    public Client(ClassLoader cl,
                  ClientInvoker invoker,
                  String subsystem)
           throws Exception

Method Detail

### setSessionId

    public void setSessionId(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.

  Parameters:
    `sessionId` -

### getSessionId

    public String getSessionId()

### isConnected

    public boolean isConnected()

### connect

    public void connect()
                 throws Exception

  Throws:
    `Exception`

### disconnect

    public void disconnect()

### getInvoker

    public ClientInvoker getInvoker()

### setInvoker

    public void setInvoker(ClientInvoker invoker)

### getSubsystem

    public String getSubsystem()

### setSubsystem

    public void setSubsystem(String subsystem)

### invoke

    public Object invoke(Object param,
                         Map sendPayload)
                  throws Throwable

  invoke the method remotely

  Parameters:
    `param` -
    `sendPayload` -
  Returns:
  Throws:
    `Throwable`

### invokeOneway

    public void invokeOneway(Object param,
                             Map sendPayload,
                             boolean clientSide)
                      throws 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 excuted 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. This is a little slower, but will know that the call made it to the server.

  Parameters:
    `param` -
    `sendPayload` -
    `clientSide` -
  Throws:
    `Throwable`

### invokeOneway

    public void invokeOneway(Object param,
                             Map sendPayload)
                      throws Throwable

  Same as calling invokeOneway(Object param, Map sendPayload, boolean clientSide) with clientSide param being false. Therefore, client thread will not return till it has made remote call.

  Parameters:
    `param` -
    `sendPayload` -
  Throws:
    `Throwable`

### addListener

    public void addListener(InvokerCallbackHandler callbackHandler)
                     throws Throwable

  Adds the specified handler as a callback listener for pull (sync) callbacks. The invoker server will then collect the callbacks for this specific handler. The callbacks can be retrieved by calling the getCallbacks() method. Note: this will cause the client invoker's client locator to be set to null.

  Parameters:
    `callbackHandler` -
  Throws:
    `Throwable`

### addListener

    public void addListener(InvokerCallbackHandler callbackHandler,
                            InvokerLocator clientLocator)
                     throws 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.

  Parameters:
    `callbackHandler` -
    `clientLocator` -
  Throws:
    `Throwable`

### removeListener

    public void removeListener(InvokerCallbackHandler callbackHandler)
                        throws 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().

  Parameters:
    `callbackHandler` -
  Throws:
    `Throwable`

### getCallbacks

    public List getCallbacks()
                      throws Throwable

  Throws:
    `Throwable`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.