Class ConnectionHolder

java.lang.Object
org.openwms.common.comm.tcp.ConnectionHolder

@Public @Lazy @Component public class ConnectionHolder extends Object
A ConnectionHolder keeps track of established connections per ConnectionFactory. It listens on events whenever a new Connection is opened and stores the ConnectionId that can be used as header argument in outbound messages.
Author:
Heiko Scherrer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Map<String,String>
     
    private final Map<String,org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory>
     
    private static final org.slf4j.Logger
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConnectionHolder(List<org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory> factories)
    Deprecated.
  • Method Summary

    Modifier and Type
    Method
    Description
    getConnectionId(String connectionFactoryName)
    Return the current active connectionId for the ConnectionFactory given by the connectionFactoryName.
    void
    onClosedMessage(org.springframework.integration.ip.tcp.connection.TcpConnectionCloseEvent event)
    On an TcpConnectionCloseEvent we try to remove the existing assignment.
    void
    onFailedConnectionMessage(org.springframework.integration.ip.tcp.connection.TcpConnectionExceptionEvent event)
    On an TcpConnectionCloseEvent we try to remove the existing assignment.
    void
    onFailedMessage(org.springframework.integration.ip.tcp.connection.TcpConnectionFailedEvent event)
    On an TcpConnectionCloseEvent we try to remove the existing assignment.
    void
    onOpenMessage(org.springframework.integration.ip.tcp.connection.TcpConnectionOpenEvent event)
    On an TcpConnectionOpenEvent we store the connectionId along with the name of the ConnectionFactory.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • connectionIds

      private Map<String,String> connectionIds
    • factories

      private final Map<String,org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory> factories
  • Constructor Details

    • ConnectionHolder

      @Deprecated public ConnectionHolder(@Autowired(required=false) List<org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory> factories)
      Deprecated.
  • Method Details

    • onOpenMessage

      @EventListener public void onOpenMessage(org.springframework.integration.ip.tcp.connection.TcpConnectionOpenEvent event)
      On an TcpConnectionOpenEvent we store the connectionId along with the name of the ConnectionFactory.
      Parameters:
      event - The event
    • onClosedMessage

      @EventListener public void onClosedMessage(org.springframework.integration.ip.tcp.connection.TcpConnectionCloseEvent event)
      On an TcpConnectionCloseEvent we try to remove the existing assignment.
      Parameters:
      event - The event
    • onFailedMessage

      @EventListener public void onFailedMessage(org.springframework.integration.ip.tcp.connection.TcpConnectionFailedEvent event)
      On an TcpConnectionCloseEvent we try to remove the existing assignment.
      Parameters:
      event - The event
    • onFailedConnectionMessage

      @EventListener public void onFailedConnectionMessage(org.springframework.integration.ip.tcp.connection.TcpConnectionExceptionEvent event)
      On an TcpConnectionCloseEvent we try to remove the existing assignment.
      Parameters:
      event - The event
    • getConnectionId

      public String getConnectionId(String connectionFactoryName)
      Return the current active connectionId for the ConnectionFactory given by the connectionFactoryName.
      Parameters:
      connectionFactoryName - Name of the ConnectionFactory
      Returns:
      The connectionId of the active Connection