Search in sources :

Example 1 with TransportFilterServerSocket

use of org.apache.geode.internal.cache.wan.TransportFilterServerSocket in project geode by apache.

the class SocketCreator method createServerSocket.

public ServerSocket createServerSocket(int nport, int backlog, InetAddress bindAddr, List<GatewayTransportFilter> transportFilters, int socketBufferSize) throws IOException {
    if (transportFilters.isEmpty()) {
        return createServerSocket(nport, backlog, bindAddr, socketBufferSize);
    } else {
        printConfig();
        ServerSocket result = new TransportFilterServerSocket(transportFilters);
        result.setReuseAddress(true);
        // Set the receive buffer size before binding the socket so
        // that large buffers will be allocated on accepted sockets (see
        // java.net.ServerSocket.setReceiverBufferSize javadocs)
        result.setReceiveBufferSize(socketBufferSize);
        try {
            result.bind(new InetSocketAddress(bindAddr, nport), backlog);
        } catch (BindException e) {
            BindException throwMe = new BindException(LocalizedStrings.SocketCreator_FAILED_TO_CREATE_SERVER_SOCKET_ON_0_1.toLocalizedString(new Object[] { bindAddr, Integer.valueOf(nport) }));
            throwMe.initCause(e);
            throw throwMe;
        }
        return result;
    }
}
Also used : TransportFilterServerSocket(org.apache.geode.internal.cache.wan.TransportFilterServerSocket) InetSocketAddress(java.net.InetSocketAddress) BindException(java.net.BindException) ServerSocket(java.net.ServerSocket) TransportFilterServerSocket(org.apache.geode.internal.cache.wan.TransportFilterServerSocket) SSLServerSocket(javax.net.ssl.SSLServerSocket)

Aggregations

BindException (java.net.BindException)1 InetSocketAddress (java.net.InetSocketAddress)1 ServerSocket (java.net.ServerSocket)1 SSLServerSocket (javax.net.ssl.SSLServerSocket)1 TransportFilterServerSocket (org.apache.geode.internal.cache.wan.TransportFilterServerSocket)1