Class TcpNioClientConnectionFactory

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
All Implemented Interfaces:
Runnable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.Lifecycle, org.springframework.integration.context.ExpressionCapable, ConnectionFactory, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.support.management.ManageableLifecycle, org.springframework.scheduling.SchedulingAwareRunnable

public class TcpNioClientConnectionFactory extends AbstractClientConnectionFactory implements org.springframework.scheduling.SchedulingAwareRunnable
A client connection factory that creates TcpNioConnections.
Since:
2.0
  • Constructor Details

    • TcpNioClientConnectionFactory

      public TcpNioClientConnectionFactory(String host, int port)
      Creates a TcpNioClientConnectionFactory for connections to the host and port.
      Parameters:
      host - the host
      port - the port
  • Method Details

    • checkActive

      protected void checkActive()
      Overrides:
      checkActive in class AbstractConnectionFactory
    • buildNewConnection

      protected TcpConnectionSupport buildNewConnection()
      Overrides:
      buildNewConnection in class AbstractClientConnectionFactory
    • setUsingDirectBuffers

      public void setUsingDirectBuffers(boolean usingDirectBuffers)
      When set to true, connections created by this factory attempt to use direct buffers where possible.
      Parameters:
      usingDirectBuffers - The usingDirectBuffers to set.
      See Also:
    • setTcpNioConnectionSupport

      public void setTcpNioConnectionSupport(TcpNioConnectionSupport tcpNioSupport)
    • isLongLived

      public boolean isLongLived()
      Specified by:
      isLongLived in interface org.springframework.scheduling.SchedulingAwareRunnable
    • stop

      public void stop()
      Description copied from class: AbstractConnectionFactory
      Stops the server.
      Specified by:
      stop in interface org.springframework.context.Lifecycle
      Specified by:
      stop in interface org.springframework.integration.support.management.ManageableLifecycle
      Overrides:
      stop in class AbstractConnectionFactory
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
      Specified by:
      start in interface org.springframework.integration.support.management.ManageableLifecycle
      Overrides:
      start in class AbstractConnectionFactory
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • isUsingDirectBuffers

      protected boolean isUsingDirectBuffers()
      Returns:
      the usingDirectBuffers
    • getConnections

      protected Map<SocketChannel,TcpNioConnection> getConnections()
      Returns:
      the connections
    • getNewChannels

      protected BlockingQueue<SocketChannel> getNewChannels()
      Returns:
      the newChannels