org.elasticsearch.transport
Class TransportService

java.lang.Object
  extended by org.elasticsearch.util.component.AbstractComponent
      extended by org.elasticsearch.util.component.AbstractLifecycleComponent<TransportService>
          extended by org.elasticsearch.transport.TransportService
All Implemented Interfaces:
CloseableComponent, LifecycleComponent<TransportService>

public class TransportService
extends AbstractLifecycleComponent<TransportService>


Field Summary
 
Fields inherited from class org.elasticsearch.util.component.AbstractLifecycleComponent
lifecycle
 
Fields inherited from class org.elasticsearch.util.component.AbstractComponent
componentSettings, logger, settings
 
Constructor Summary
TransportService(Settings settings, Transport transport, ThreadPool threadPool)
           
TransportService(Transport transport, ThreadPool threadPool)
           
 
Method Summary
 boolean addressSupported(java.lang.Class<? extends TransportAddress> address)
           
 BoundTransportAddress boundAddress()
           
protected  void doClose()
           
protected  void doStart()
           
protected  void doStop()
           
 void nodesAdded(java.lang.Iterable<DiscoveryNode> nodes)
           
 void nodesRemoved(java.lang.Iterable<DiscoveryNode> nodes)
           
 void registerHandler(ActionTransportRequestHandler handler)
           
 void registerHandler(java.lang.String action, TransportRequestHandler handler)
           
 void removeHandler(java.lang.String action)
           
<T extends Streamable>
void
sendRequest(DiscoveryNode node, java.lang.String action, Streamable message, TransportResponseHandler<T> handler)
           
<T extends Streamable>
TransportFuture<T>
submitRequest(DiscoveryNode node, java.lang.String action, Streamable message, TransportResponseHandler<T> handler)
           
 void throwConnectException(boolean throwConnectException)
          Set to true to indicate that a ConnectTransportException should be thrown when sending a message (otherwise, it will be passed to the response handler).
 
Methods inherited from class org.elasticsearch.util.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
 
Methods inherited from class org.elasticsearch.util.component.AbstractComponent
nodeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransportService

public TransportService(Transport transport,
                        ThreadPool threadPool)

TransportService

@Inject
public TransportService(Settings settings,
                               Transport transport,
                               ThreadPool threadPool)
Method Detail

doStart

protected void doStart()
                throws ElasticSearchException
Specified by:
doStart in class AbstractLifecycleComponent<TransportService>
Throws:
ElasticSearchException

doStop

protected void doStop()
               throws ElasticSearchException
Specified by:
doStop in class AbstractLifecycleComponent<TransportService>
Throws:
ElasticSearchException

doClose

protected void doClose()
                throws ElasticSearchException
Specified by:
doClose in class AbstractLifecycleComponent<TransportService>
Throws:
ElasticSearchException

addressSupported

public boolean addressSupported(java.lang.Class<? extends TransportAddress> address)

boundAddress

public BoundTransportAddress boundAddress()

nodesAdded

public void nodesAdded(java.lang.Iterable<DiscoveryNode> nodes)

nodesRemoved

public void nodesRemoved(java.lang.Iterable<DiscoveryNode> nodes)

throwConnectException

public void throwConnectException(boolean throwConnectException)
Set to true to indicate that a ConnectTransportException should be thrown when sending a message (otherwise, it will be passed to the response handler). Defaults to false.

This is useful when logic based on connect failure is needed without having to wrap the handler, for example, in case of retries across several nodes.


submitRequest

public <T extends Streamable> TransportFuture<T> submitRequest(DiscoveryNode node,
                                                               java.lang.String action,
                                                               Streamable message,
                                                               TransportResponseHandler<T> handler)
                                                    throws TransportException
Throws:
TransportException

sendRequest

public <T extends Streamable> void sendRequest(DiscoveryNode node,
                                               java.lang.String action,
                                               Streamable message,
                                               TransportResponseHandler<T> handler)
                 throws TransportException
Throws:
TransportException

registerHandler

public void registerHandler(ActionTransportRequestHandler handler)

registerHandler

public void registerHandler(java.lang.String action,
                            TransportRequestHandler handler)

removeHandler

public void removeHandler(java.lang.String action)