Search in sources :

Example 6 with TNonblockingSocket

use of org.apache.thrift.transport.TNonblockingSocket in project eiger by wlloyd.

the class TCustomNonblockingServerSocket method acceptImpl.

@Override
protected TNonblockingSocket acceptImpl() throws TTransportException {
    TNonblockingSocket tsocket = super.acceptImpl();
    if (tsocket == null || tsocket.getSocketChannel() == null)
        return tsocket;
    Socket socket = tsocket.getSocketChannel().socket();
    // clean up the old information.
    SocketSessionManagementService.instance.remove(socket.getRemoteSocketAddress());
    try {
        socket.setKeepAlive(this.keepAlive);
    } catch (SocketException se) {
        logger.warn("Failed to set keep-alive on Thrift socket.", se);
    }
    if (this.sendBufferSize != null) {
        try {
            socket.setSendBufferSize(this.sendBufferSize.intValue());
        } catch (SocketException se) {
            logger.warn("Failed to set send buffer size on Thrift socket.", se);
        }
    }
    if (this.recvBufferSize != null) {
        try {
            socket.setReceiveBufferSize(this.recvBufferSize.intValue());
        } catch (SocketException se) {
            logger.warn("Failed to set receive buffer size on Thrift socket.", se);
        }
    }
    return tsocket;
}
Also used : TNonblockingSocket(org.apache.thrift.transport.TNonblockingSocket) SocketException(java.net.SocketException) TNonblockingServerSocket(org.apache.thrift.transport.TNonblockingServerSocket) Socket(java.net.Socket) TNonblockingSocket(org.apache.thrift.transport.TNonblockingSocket)

Aggregations

TNonblockingSocket (org.apache.thrift.transport.TNonblockingSocket)6 IOException (java.io.IOException)2 Socket (java.net.Socket)2 TException (org.apache.thrift.TException)2 TAsyncClientManager (org.apache.thrift.async.TAsyncClientManager)2 TNonblockingServerSocket (org.apache.thrift.transport.TNonblockingServerSocket)2 Test (org.junit.Test)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 SocketAddressFieldAccessor (com.navercorp.pinpoint.plugin.thrift.field.accessor.SocketAddressFieldAccessor)1 SocketFieldAccessor (com.navercorp.pinpoint.plugin.thrift.field.accessor.SocketFieldAccessor)1 InetSocketAddress (java.net.InetSocketAddress)1 SocketAddress (java.net.SocketAddress)1 SocketException (java.net.SocketException)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 SSLSocket (javax.net.ssl.SSLSocket)1 SSLSocketFactory (javax.net.ssl.SSLSocketFactory)1 RemoteMap (net.morimekta.test.providence.thrift.map.RemoteMap)1 AsyncMethodCallback (org.apache.thrift.async.AsyncMethodCallback)1