org.jboss.remoting.transport.local
Class LocalClientInvoker

java.lang.Object
  extended by org.jboss.remoting.AbstractInvoker
      extended by org.jboss.remoting.transport.local.LocalClientInvoker
All Implemented Interfaces:
Invoker, BidirectionalClientInvoker, ClientInvoker

public class LocalClientInvoker
extends AbstractInvoker
implements BidirectionalClientInvoker

LocalClientInvoker does not use any transport protocol for invoking the ServerInvoker, instead will make call directly on it locally. This increases performance since no serialization required as well as needed for push callbacks where InvokerCallbackHandler is in same JVM as the callback server.

Version:
$Revision: 2320 $
Author:
Tom Elrod

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.remoting.AbstractInvoker
AbstractInvoker.CallbackLocatorHolder
 
Field Summary
 
Fields inherited from class org.jboss.remoting.AbstractInvoker
classbyteloader, configuration, localServerLocators, locator, passConfigMapToMarshalFactory, serializationType, socketFactory, socketFactoryCreatedFromSSLParameters
 
Constructor Summary
LocalClientInvoker(InvokerLocator locator)
           
LocalClientInvoker(InvokerLocator locator, java.util.Map configuration)
           
LocalClientInvoker(InvokerLocator locator, java.util.Map configuration, boolean byValue)
           
 
Method Summary
 void connect()
          connect to the remote invoker
 void disconnect()
          disconnect from the remote invoker.
 void establishLease(java.lang.String sessionID, java.util.Map configuration, long leasePeriod)
           
 InvokerLocator getCallbackLocator(java.util.Map metadata)
          Gets the locator to be used for callbacks when want do not want to establish a new physical connectiong from the server to the client.
 long getLeasePeriod(java.lang.String sessionID)
           
 Marshaller getMarshaller()
           
 UnMarshaller getUnMarshaller()
           
 java.lang.Object invoke(InvocationRequest invocation)
          transport a request against a remote ServerInvoker
 boolean isConnected()
          subclasses must provide this method to return true if their remote connection is connected and false if disconnected.
protected  InvocationRequest marshallInvocation(InvocationRequest localInvocation)
           
 void setMarshaller(Marshaller marshaller)
           
 void setServerInvoker(ServerInvoker svrInvoker)
          This will set the local reference to the server invoker.
 void setUnMarshaller(UnMarshaller unmarshaller)
           
 void terminateLease(java.lang.String sessionId, int disconnectTimeout)
          Must behave as a noop if there's no active lease.
 
Methods inherited from class org.jboss.remoting.AbstractInvoker
addClientLocator, createSocketFactory, getClassLoader, getClientLocator, getClientLocators, getConfiguration, getLocator, getSerializationType, getSocketFactory, isCompleteSocketFactory, isSocketFactoryCreatedFromSSLParameters, needsCustomSSLConfiguration, setClassLoader, setSerializationType, setSocketFactory, wrapSocketFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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
 

Constructor Detail

LocalClientInvoker

public LocalClientInvoker(InvokerLocator locator)

LocalClientInvoker

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

LocalClientInvoker

public LocalClientInvoker(InvokerLocator locator,
                          java.util.Map configuration,
                          boolean byValue)
Method Detail

invoke

public java.lang.Object invoke(InvocationRequest invocation)
                        throws java.lang.Throwable
transport a request against a remote ServerInvoker

Specified by:
invoke in interface ClientInvoker
Parameters:
invocation -
Returns:
Throws:
java.lang.Throwable

marshallInvocation

protected InvocationRequest marshallInvocation(InvocationRequest localInvocation)
                                        throws java.io.IOException,
                                               java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

isConnected

public boolean isConnected()
subclasses must provide this method to return true if their remote connection is connected and false if disconnected. in some transports, such as SOAP, this method may always return true, since the remote connectivity is done on demand and not kept persistent like other transports (such as socket-based transport).

Specified by:
isConnected in interface ClientInvoker
Returns:
boolean true if connected, false if not

connect

public void connect()
             throws ConnectionFailedException
connect to the remote invoker

Specified by:
connect in interface ClientInvoker
Throws:
ConnectionFailedException

disconnect

public void disconnect()
disconnect from the remote invoker. Once disconnect called will not be able to re-connect by calling connect since will loose reference to server invoker.

Specified by:
disconnect in interface ClientInvoker

setMarshaller

public void setMarshaller(Marshaller marshaller)
Specified by:
setMarshaller in interface ClientInvoker

getMarshaller

public Marshaller getMarshaller()
Specified by:
getMarshaller in interface ClientInvoker

setUnMarshaller

public void setUnMarshaller(UnMarshaller unmarshaller)
Specified by:
setUnMarshaller in interface ClientInvoker

getUnMarshaller

public UnMarshaller getUnMarshaller()
Specified by:
getUnMarshaller in interface ClientInvoker

establishLease

public void establishLease(java.lang.String sessionID,
                           java.util.Map configuration,
                           long leasePeriod)
                    throws java.lang.Throwable
Specified by:
establishLease in interface ClientInvoker
Throws:
java.lang.Throwable

terminateLease

public void terminateLease(java.lang.String sessionId,
                           int disconnectTimeout)
Description copied from interface: ClientInvoker
Must behave as a noop if there's no active lease.

Specified by:
terminateLease in interface ClientInvoker

getLeasePeriod

public long getLeasePeriod(java.lang.String sessionID)
Specified by:
getLeasePeriod in interface ClientInvoker
Returns:
the lease period (in ms) if the client has an active leasing mechanism with the server or -1 otherwise.

setServerInvoker

public void setServerInvoker(ServerInvoker svrInvoker)
This will set the local reference to the server invoker. This is needed to so can make calls directly against server.

Parameters:
svrInvoker -

getCallbackLocator

public InvokerLocator getCallbackLocator(java.util.Map metadata)
Description copied from interface: BidirectionalClientInvoker
Gets the locator to be used for callbacks when want do not want to establish a new physical connectiong from the server to the client.

Specified by:
getCallbackLocator in interface BidirectionalClientInvoker
Returns:


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