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.transport.socket
Class MicroSocketClientInvoker

    java.lang.Object
      org.jboss.remoting.AbstractInvoker
          org.jboss.remoting.MicroRemoteClientInvoker
              org.jboss.remoting.RemoteClientInvoker
                  org.jboss.remoting.transport.socket.MicroSocketClientInvoker

All Implemented Interfaces:
  Invoker, ClientInvoker

Direct Known Subclasses:
  SocketClientInvoker

    public class MicroSocketClientInvoker

extends RemoteClientInvoker

SocketClientInvoker uses Sockets to remotely connect to the a remote ServerInvoker, which must be a SocketServerInvoker.

Version:
  $Revision: 3085 $
Author:
  Jeff Haynie, Tom Elrod, Ovidiu Feodorov

Nested Class Summary

Nested classes/interfaces inherited from class org.jboss.remoting.AbstractInvoker
`AbstractInvoker.CallbackLocatorHolder`

Field Summary
`protected java.net.InetAddress` | `addr`
`protected ServerAddress` | `address` connection information
`static java.lang.String` | `CLIENT_SOCKET_CLASS_FLAG` Specifies the fully qualified class name for the custom SocketWrapper implementation to use on the client.
`protected java.lang.Class` | `clientSocketClass`
`protected java.lang.String` | `clientSocketClassName`
`protected static java.util.Map` | `connectionPools`
`static long` | `deserializeTime`
`protected boolean` | `enableTcpNoDelay` If the TcpNoDelay option should be used on the socket.
`static long` | `getSocketTime`
`static int` | `MAX_CALL_RETRIES` Default maximum number of times a invocation will be made when it gets a SocketException.
`static int` | `MAX_POOL_SIZE` Default maximum number of socket connections allowed at any point in time.
`static java.lang.String` | `MAX_POOL_SIZE_FLAG` The client side maximum number of threads.
`static int` | `MAX_RETRIES` Default maximum number of retries to get a valid socket from the* socket pool.
`protected int` | `maxPoolSize`
`protected int` | `numberOfCallRetries`
`protected int` | `numberOfRetries`
`protected java.util.LinkedList` | `pool` Pool for this invoker.
`protected int` | `port`
`static long` | `readTime`
`protected EDU.oswego.cs.dl.util.concurrent.Semaphore` | `semaphore`
`protected static java.util.Map` | `semaphores`
`static long` | `serializeTime`
`protected boolean` | `shouldCheckConnection` Indicates if will check the socket connection when getting from pool by sending byte over the connection to validate is still good.
`static boolean` | `TCP_NODELAY_DEFAULT` Default value for enable TCP nodelay.
`static java.lang.String` | `TCP_NODELAY_FLAG` Can be either true or false and will indicate if client socket should have TCP_NODELAY turned on or off.
`java.lang.Object` | `usedPoolLock`
`static long` | `writeTime`

Fields inherited from class org.jboss.remoting.MicroRemoteClientInvoker
`connected`

Fields inherited from class org.jboss.remoting.AbstractInvoker
`classbyteloader, configuration, localServerLocators, locator, serializationType, socketFactory, socketFactoryCreatedFromSSLParameters`

Constructor Summary
`MicroSocketClientInvoker(InvokerLocator locator)`
`MicroSocketClientInvoker(InvokerLocator locator, java.util.Map configuration)`

Method Summary
`boolean` | `checkingConnection()` Indicates if will check socket connection when returning from pool by sending byte to the server.
`static void` | `clearPool(java.util.LinkedList thepool)` Close all sockets in a specific pool.
`static void` | `clearPools()` Close all sockets in all pools.
`protected void` | `configureParameters()`
`protected SocketWrapper` | `createClientSocket(java.net.Socket socket, int timeout, java.util.Map metadata)`
`protected ServerAddress` | `createServerAddress()`
`protected java.net.Socket` | `createSocket(java.lang.String address, int port, int timeout)`
`void` | `disconnect()` disconnect from the remote invokere
`protected void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`void` | `flushConnectionPool()`
`protected SocketWrapper` | `getConnection(Marshaller marshaller, UnMarshaller unmarshaller, int timeAllowed)`
`protected java.lang.String` | `getDefaultDataType()` Each implementation of the remote client invoker should have a default data type that is used in the case it is not specified in the invoker locator URI.
`int` | `getNumberOfAvailableConnections()`
`int` | `getNumberOfCallRetries()`
`int` | `getNumberOfRetries()`
`int` | `getNumberOfUsedConnections()`
`protected SocketWrapper` | `getPooledConnection()`
`boolean` | `getReuseAddress()` Returns if newly created sockets will have SO_REUSEADDR enabled.
`java.lang.String` | `getServerHostName()` The name of of the server.
`protected void` | `handleConnect()` Subclasses must implement this method to provide a hook to connect to the remote server, if this applies to the specific transport.
`protected void` | `handleDisconnect()` Subclasses must implement this method to provide a hook to disconnect from the remote server, if this applies to the specific transport.
`protected java.lang.Object` | `handleException(java.lang.Exception ex, SocketWrapper socketWrapper)`
`protected void` | `initPool()`
`void` | `setNumberOfCallRetries(int numberOfCallRetries)` Sets the number of times an invocation will retry based on getting SocketException.
`void` | `setNumberOfRetries(int numberOfRetries)` Sets the number of retries to get a socket connection.
`void` | `setReuseAddress(boolean reuse)` Sets if newly created socket should have SO_REUSEADDR enable.
`protected void` | `setup()`
`protected java.lang.Object` | `transport(java.lang.String sessionID, java.lang.Object invocation, java.util.Map metadata, Marshaller marshaller, UnMarshaller unmarshaller)`

Methods inherited from class org.jboss.remoting.MicroRemoteClientInvoker
`connect, establishLease, getLeasePeriod, getMarshaller, getSessionId, getUnMarshaller, invoke, isConnected, postProcess, preProcess, setMarshaller, setUnMarshaller, terminateLease`

Methods inherited from class org.jboss.remoting.AbstractInvoker
`addClientLocator, createSocketFactory, getClassLoader, getClientLocator, getClientLocators, getLocator, getSerializationType, getSocketFactory, isCompleteSocketFactory, isSocketFactoryCreatedFromSSLParameters, needsCustomSSLConfiguration, setClassLoader, setSerializationType, setSocketFactory, wrapSocketFactory`

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

Methods inherited from interface org.jboss.remoting.transport.ClientInvoker
`addClientLocator, getClientLocator, getClientLocators, getSocketFactory, setSocketFactory`

Methods inherited from interface org.jboss.remoting.Invoker
`getLocator`

Field Detail

### TCP_NODELAY_FLAG

    public static final java.lang.String TCP_NODELAY_FLAG

  Can be either true or false and will indicate if client socket should have TCP_NODELAY turned on or off. TCP_NODELAY is for a specific purpose; to disable the Nagle buffering algorithm. It should only be set for applications that send frequent small bursts of information without getting an immediate response; where timely delivery of data is required (the canonical example is mouse movements). The default is false.

  See Also:
    Constant Field Values

### MAX_POOL_SIZE_FLAG

    public static final java.lang.String MAX_POOL_SIZE_FLAG

  The client side maximum number of threads. The default is MAX_POOL_SIZE.

  See Also:
    Constant Field Values

### CLIENT_SOCKET_CLASS_FLAG

    public static final java.lang.String CLIENT_SOCKET_CLASS_FLAG

  Specifies the fully qualified class name for the custom SocketWrapper implementation to use on the client. Note, will need to make sure this is marked as a client parameter (using the 'isParam' attribute). Making this change will not affect the marshaller/unmarshaller that is used, which may also be a requirement.

  See Also:
    Constant Field Values

### TCP_NODELAY_DEFAULT

    public static final boolean TCP_NODELAY_DEFAULT

  Default value for enable TCP nodelay. Value is false.

  See Also:
    Constant Field Values

### MAX_RETRIES

    public static final int MAX_RETRIES

  Default maximum number of retries to get a valid socket from the* socket pool. This also translates to number of seconds will wait for connection to be returned to connection pool before erroring. Default is 30.

  See Also:
    Constant Field Values

### MAX_CALL_RETRIES

    public static final int MAX_CALL_RETRIES

  Default maximum number of times a invocation will be made when it gets a SocketException. Default is 3.

  See Also:
    Constant Field Values

### MAX_POOL_SIZE

    public static final int MAX_POOL_SIZE

  Default maximum number of socket connections allowed at any point in time. Default is 50.

  See Also:
    Constant Field Values

### connectionPools

    protected static final java.util.Map connectionPools

### semaphores

    protected static final java.util.Map semaphores

### getSocketTime

    public static long getSocketTime

### readTime

    public static long readTime

### writeTime

    public static long writeTime

### serializeTime

    public static long serializeTime

### deserializeTime

    public static long deserializeTime

### addr

    protected java.net.InetAddress addr

### port

    protected int port

### shouldCheckConnection

    protected boolean shouldCheckConnection

  Indicates if will check the socket connection when getting from pool by sending byte over the connection to validate is still good.

### enableTcpNoDelay

    protected boolean enableTcpNoDelay

  If the TcpNoDelay option should be used on the socket.

### clientSocketClassName

    protected java.lang.String clientSocketClassName

### clientSocketClass

    protected java.lang.Class clientSocketClass

### numberOfRetries

    protected int numberOfRetries

### numberOfCallRetries

    protected int numberOfCallRetries

### maxPoolSize

    protected int maxPoolSize

### pool

    protected java.util.LinkedList pool

  Pool for this invoker. This is shared between all instances of proxies attached to a specific invoker.

### semaphore

    protected EDU.oswego.cs.dl.util.concurrent.Semaphore semaphore

### address

    protected ServerAddress address

  connection information

### usedPoolLock

    public java.lang.Object usedPoolLock

Constructor Detail

### MicroSocketClientInvoker

    public MicroSocketClientInvoker(InvokerLocator locator)

### MicroSocketClientInvoker

    public MicroSocketClientInvoker(InvokerLocator locator,
                                    java.util.Map configuration)

Method Detail

### clearPool

    public static void clearPool(java.util.LinkedList thepool)

  Close all sockets in a specific pool.

### clearPools

    public static void clearPools()

  Close all sockets in all pools.

### checkingConnection

    public boolean checkingConnection()

  Indicates if will check socket connection when returning from pool by sending byte to the server. Default value will be false.

### getReuseAddress

    public boolean getReuseAddress()

  Returns if newly created sockets will have SO_REUSEADDR enabled. Default is for this to be true.

### setReuseAddress

    public void setReuseAddress(boolean reuse)

  Sets if newly created socket should have SO_REUSEADDR enable. Default is true.

### disconnect

    public void disconnect()

  Description copied from class: `MicroRemoteClientInvoker`
  disconnect from the remote invokere

  Specified by:
    `disconnect` in interface `ClientInvoker`
  Overrides:
    `disconnect` in class `MicroRemoteClientInvoker`

### flushConnectionPool

    public void flushConnectionPool()

### setNumberOfCallRetries

    public void setNumberOfCallRetries(int numberOfCallRetries)

  Sets the number of times an invocation will retry based on getting SocketException.

### getNumberOfCallRetries

    public int getNumberOfCallRetries()

### setNumberOfRetries

    public void setNumberOfRetries(int numberOfRetries)

  Sets the number of retries to get a socket connection.

  Parameters:
    `numberOfRetries` - Must be a number greater than 0.

### getNumberOfRetries

    public int getNumberOfRetries()

### getServerHostName

    public java.lang.String getServerHostName()
                                       throws java.lang.Exception

  The name of of the server.

  Throws:
    `java.lang.Exception`

### getNumberOfUsedConnections

    public int getNumberOfUsedConnections()

### getNumberOfAvailableConnections

    public int getNumberOfAvailableConnections()

### setup

    protected void setup()
                  throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### configureParameters

    protected void configureParameters()

### createServerAddress

    protected ServerAddress createServerAddress()

### finalize

    protected void finalize()
                     throws java.lang.Throwable

  Description copied from class: `MicroRemoteClientInvoker`
  Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the `finalize` method to dispose of system resources or to perform other cleanup.

  The general contract of `finalize` is that it is invoked if and when the JavaTM virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The `finalize` method may take any action, including making this object available again to other threads; the usual purpose of `finalize`, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

  The `finalize` method of class `Object` performs no special action; it simply returns normally. Subclasses of `Object` may override this definition.

  The Java programming language does not guarantee which thread will transport the `finalize` method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

  After the `finalize` method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

  The `finalize` method is never invoked more than once by a Java virtual machine for any given object.

  Any exception thrown by the `finalize` method causes the finalization of this object to be halted, but is otherwise ignored.

  Overrides:
    `finalize` in class `MicroRemoteClientInvoker`
  Throws:
    `java.lang.Throwable` - the `Exception` raised by this method

### handleConnect

    protected void handleConnect()
                          throws ConnectionFailedException

  Description copied from class: `MicroRemoteClientInvoker`
  Subclasses must implement this method to provide a hook to connect to the remote server, if this applies to the specific transport. However, in some transport implementations, this may not make must difference since the connection is not persistent among invocations, such as SOAP. In these cases, the method should silently return without any processing.

  Specified by:
    `handleConnect` in class `MicroRemoteClientInvoker`
  Throws:
    `ConnectionFailedException`

### handleDisconnect

    protected void handleDisconnect()

  Description copied from class: `MicroRemoteClientInvoker`
  Subclasses must implement this method to provide a hook to disconnect from the remote server, if this applies to the specific transport. However, in some transport implementations, this may not make must difference since the connection is not persistent among invocations, such as SOAP. In these cases, the method should silently return without any processing.

  Specified by:
    `handleDisconnect` in class `MicroRemoteClientInvoker`

### getDefaultDataType

    protected java.lang.String getDefaultDataType()

  Each implementation of the remote client invoker should have a default data type that is used in the case it is not specified in the invoker locator URI.

  Specified by:
    `getDefaultDataType` in class `MicroRemoteClientInvoker`

### transport

    protected java.lang.Object transport(java.lang.String sessionID,
                                         java.lang.Object invocation,
                                         java.util.Map metadata,
                                         Marshaller marshaller,
                                         UnMarshaller unmarshaller)
                                  throws java.io.IOException,
                                         ConnectionFailedException,
                                         java.lang.ClassNotFoundException

  Specified by:
    `transport` in class `MicroRemoteClientInvoker`
  Throws:
    `java.io.IOException`
    `ConnectionFailedException`
    `java.lang.ClassNotFoundException`

### handleException

    protected java.lang.Object handleException(java.lang.Exception ex,
                                               SocketWrapper socketWrapper)
                                        throws java.lang.ClassNotFoundException,
                                               java.rmi.MarshalException

  Throws:
    `java.lang.ClassNotFoundException`
    `java.rmi.MarshalException`

### initPool

    protected void initPool()

### getConnection

    protected SocketWrapper getConnection(Marshaller marshaller,
                                          UnMarshaller unmarshaller,
                                          int timeAllowed)
                                   throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### createClientSocket

    protected SocketWrapper createClientSocket(java.net.Socket socket,
                                               int timeout,
                                               java.util.Map metadata)
                                        throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### createSocket

    protected java.net.Socket createSocket(java.lang.String address,
                                           int port,
                                           int timeout)
                                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### getPooledConnection

    protected SocketWrapper getPooledConnection()

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 ? 1998-2005 JBoss Inc . All Rights Reserved.