org.fusesource.fabric.dosgi.tcp
Class ClientInvokerImpl

java.lang.Object
  extended by org.fusesource.fabric.dosgi.tcp.ClientInvokerImpl
All Implemented Interfaces:
Dispatched, ClientInvoker, Service

public class ClientInvokerImpl
extends java.lang.Object
implements ClientInvoker, Dispatched


Nested Class Summary
protected  class ClientInvokerImpl.InvokerTransportPool
           
protected  class ClientInvokerImpl.ProxyInvocationHandler
           
 
Field Summary
protected  java.util.concurrent.atomic.AtomicLong correlationGenerator
           
static long DEFAULT_TIMEOUT
           
protected static org.slf4j.Logger LOGGER
           
protected  org.fusesource.hawtdispatch.DispatchQueue queue
           
protected  java.util.Map<java.lang.Long,ResponseFuture> requests
           
protected  java.util.concurrent.atomic.AtomicBoolean running
           
protected  java.util.Map<java.lang.String,SerializationStrategy> serializationStrategies
           
protected  long timeout
           
protected  java.util.Map<java.lang.String,TransportPool> transports
           
 
Constructor Summary
ClientInvokerImpl(org.fusesource.hawtdispatch.DispatchQueue queue, long timeout, java.util.Map<java.lang.String,SerializationStrategy> serializationStrategies)
           
ClientInvokerImpl(org.fusesource.hawtdispatch.DispatchQueue queue, java.util.Map<java.lang.String,SerializationStrategy> serializationStrategies)
           
 
Method Summary
 java.lang.reflect.InvocationHandler getProxy(java.lang.String address, java.lang.String service, java.lang.ClassLoader classLoader)
           
protected  void onCommand(TransportPool pool, java.lang.Object data)
           
protected  void onFailure(java.lang.Object id, java.lang.Throwable throwable)
           
 org.fusesource.hawtdispatch.DispatchQueue queue()
           
protected  java.lang.Object request(ClientInvokerImpl.ProxyInvocationHandler handler, java.lang.String address, org.fusesource.hawtbuf.UTF8Buffer service, java.lang.ClassLoader classLoader, java.lang.reflect.Method method, java.lang.Object[] args)
           
 void start()
          Starts the service.
 void start(java.lang.Runnable onComplete)
          Starts the service.
 void stop()
          Stops the service.
 void stop(java.lang.Runnable onComplete)
          Stops the service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIMEOUT

public static final long DEFAULT_TIMEOUT

LOGGER

protected static final org.slf4j.Logger LOGGER

correlationGenerator

protected final java.util.concurrent.atomic.AtomicLong correlationGenerator

queue

protected final org.fusesource.hawtdispatch.DispatchQueue queue

transports

protected final java.util.Map<java.lang.String,TransportPool> transports

running

protected final java.util.concurrent.atomic.AtomicBoolean running

requests

protected final java.util.Map<java.lang.Long,ResponseFuture> requests

timeout

protected final long timeout

serializationStrategies

protected final java.util.Map<java.lang.String,SerializationStrategy> serializationStrategies
Constructor Detail

ClientInvokerImpl

public ClientInvokerImpl(org.fusesource.hawtdispatch.DispatchQueue queue,
                         java.util.Map<java.lang.String,SerializationStrategy> serializationStrategies)

ClientInvokerImpl

public ClientInvokerImpl(org.fusesource.hawtdispatch.DispatchQueue queue,
                         long timeout,
                         java.util.Map<java.lang.String,SerializationStrategy> serializationStrategies)
Method Detail

queue

public org.fusesource.hawtdispatch.DispatchQueue queue()
Specified by:
queue in interface Dispatched

start

public void start()
           throws java.lang.Exception
Description copied from interface: Service
Starts the service. No guarantee is given that the service has fully started by the time this method returns.

Specified by:
start in interface Service
Throws:
java.lang.Exception

start

public void start(java.lang.Runnable onComplete)
           throws java.lang.Exception
Description copied from interface: Service
Starts the service. Executes the onComplete runnable once the service has fully started up.

Specified by:
start in interface Service
Parameters:
onComplete - my be set to null if not interested in a callback.
Throws:
java.lang.Exception

stop

public void stop()
Description copied from interface: Service
Stops the service. No guarantee is given that the service has fully stopped by the time this method returns.

Specified by:
stop in interface Service

stop

public void stop(java.lang.Runnable onComplete)
Description copied from interface: Service
Stops the service. Executes the onComplete runnable once the service has fully stopped.

Specified by:
stop in interface Service
Parameters:
onComplete - my be set to null if not interested in a callback.

getProxy

public java.lang.reflect.InvocationHandler getProxy(java.lang.String address,
                                                    java.lang.String service,
                                                    java.lang.ClassLoader classLoader)
Specified by:
getProxy in interface ClientInvoker

onCommand

protected void onCommand(TransportPool pool,
                         java.lang.Object data)

onFailure

protected void onFailure(java.lang.Object id,
                         java.lang.Throwable throwable)

request

protected java.lang.Object request(ClientInvokerImpl.ProxyInvocationHandler handler,
                                   java.lang.String address,
                                   org.fusesource.hawtbuf.UTF8Buffer service,
                                   java.lang.ClassLoader classLoader,
                                   java.lang.reflect.Method method,
                                   java.lang.Object[] args)
                            throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2013 Red Hat. All Rights Reserved.