Example usage for org.springframework.integration.ip.tcp.connection TcpConnectionInterceptorFactory getInterceptor

List of usage examples for org.springframework.integration.ip.tcp.connection TcpConnectionInterceptorFactory getInterceptor

Introduction

In this page you can find the example usage for org.springframework.integration.ip.tcp.connection TcpConnectionInterceptorFactory getInterceptor.

Prototype

TcpConnectionInterceptorSupport getInterceptor();

Source Link

Document

Called for each new connection; a new interceptor must be returned on each call.

Usage

From source file:org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory.java

protected TcpConnection wrapConnection(TcpConnection connection) throws Exception {
    if (this.interceptorFactoryChain == null) {
        return connection;
    }/*from   www .  ja  v  a 2  s.  c o  m*/
    TcpConnectionInterceptorFactory[] interceptorFactories = this.interceptorFactoryChain
            .getInterceptorFactories();
    if (interceptorFactories == null) {
        return connection;
    }
    for (TcpConnectionInterceptorFactory factory : interceptorFactories) {
        TcpConnectionInterceptor wrapper = factory.getInterceptor();
        wrapper.setTheConnection(connection);
        // if no ultimate listener or sender, register each wrapper in turn
        if (this.listener == null) {
            connection.registerListener(wrapper);
        }
        if (this.sender == null) {
            connection.registerSender(wrapper);
        }
        connection = wrapper;
    }
    return connection;
}