Search in sources :

Example 6 with TSocket

use of org.apache.thrift.transport.TSocket in project zeppelin by apache.

the class ClientFactory method create.

@Override
public Client create() throws Exception {
    TSocket transport = new TSocket(host, port);
    try {
        transport.open();
    } catch (TTransportException e) {
        throw new InterpreterException(e);
    }
    TProtocol protocol = new TBinaryProtocol(transport);
    Client client = new RemoteInterpreterService.Client(protocol);
    synchronized (clientSocketMap) {
        clientSocketMap.put(client, transport);
    }
    return client;
}
Also used : TBinaryProtocol(org.apache.thrift.protocol.TBinaryProtocol) TProtocol(org.apache.thrift.protocol.TProtocol) InterpreterException(org.apache.zeppelin.interpreter.InterpreterException) TTransportException(org.apache.thrift.transport.TTransportException) Client(org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client) TSocket(org.apache.thrift.transport.TSocket)

Example 7 with TSocket

use of org.apache.thrift.transport.TSocket in project hive by apache.

the class HiveAuthUtils method getSSLSocket.

public static TTransport getSSLSocket(String host, int port, int loginTimeout, String trustStorePath, String trustStorePassWord) throws TTransportException {
    TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters();
    params.setTrustStore(trustStorePath, trustStorePassWord);
    params.requireClientAuth(true);
    // The underlying SSLSocket object is bound to host:port with the given SO_TIMEOUT and
    // SSLContext created with the given params
    TSocket tSSLSocket = TSSLTransportFactory.getClientSocket(host, port, loginTimeout, params);
    return getSSLSocketWithHttps(tSSLSocket);
}
Also used : TSSLTransportFactory(org.apache.thrift.transport.TSSLTransportFactory) TSocket(org.apache.thrift.transport.TSocket)

Example 8 with TSocket

use of org.apache.thrift.transport.TSocket in project buck by facebook.

the class ThriftCoordinatorClient method start.

public ThriftCoordinatorClient start() throws IOException {
    transport = new TFramedTransport(new TSocket(remoteHost, remotePort));
    Stopwatch stopwatch = Stopwatch.createStarted();
    while (true) {
        try {
            transport.open();
            break;
        } catch (TTransportException e) {
            if (stopwatch.elapsed(TimeUnit.SECONDS) > MAX_CONNECT_TIMEOUT_SECONDS) {
                throw new IOException(String.format("Failed to connect. Coordinator is still not healthy after [%d] seconds.", MAX_CONNECT_TIMEOUT_SECONDS));
            }
            LOG.debug("Coordinator server currently not available. Retrying in a bit...");
            try {
                Thread.sleep(TimeUnit.SECONDS.toMillis(RETRY_TIMEOUT_SECONDS));
            } catch (InterruptedException innerException) {
                throw new RuntimeException(innerException);
            }
        }
    }
    TProtocol protocol = new TBinaryProtocol(transport);
    client = new CoordinatorService.Client(protocol);
    return this;
}
Also used : TBinaryProtocol(org.apache.thrift.protocol.TBinaryProtocol) TProtocol(org.apache.thrift.protocol.TProtocol) TFramedTransport(org.apache.thrift.transport.TFramedTransport) Stopwatch(com.google.common.base.Stopwatch) TTransportException(org.apache.thrift.transport.TTransportException) CoordinatorService(com.facebook.buck.distributed.thrift.CoordinatorService) IOException(java.io.IOException) TSocket(org.apache.thrift.transport.TSocket)

Example 9 with TSocket

use of org.apache.thrift.transport.TSocket in project pinpoint by naver.

the class TSocketConstructInterceptor method after.

@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
    if (isDebug) {
        logger.afterInterceptor(target, args, result, throwable);
    }
    if (validate(target)) {
        Socket socket = ((TSocket) target).getSocket();
        ((SocketFieldAccessor) target)._$PINPOINT$_setSocket(socket);
    }
}
Also used : SocketFieldAccessor(com.navercorp.pinpoint.plugin.thrift.field.accessor.SocketFieldAccessor) Socket(java.net.Socket) TSocket(org.apache.thrift.transport.TSocket) TSocket(org.apache.thrift.transport.TSocket)

Example 10 with TSocket

use of org.apache.thrift.transport.TSocket in project metacat by Netflix.

the class HiveMetastoreClientFactory method createRawTransport.

protected TTransport createRawTransport(final String host, final int port) throws TTransportException {
    if (socksProxy == null) {
        final TTransport transport = new TSocket(host, port, timeoutMillis);
        try {
            transport.open();
            return transport;
        } catch (Throwable t) {
            transport.close();
            throw t;
        }
    }
    final Socket socks = createSocksSocket(socksProxy);
    try {
        try {
            socks.connect(InetSocketAddress.createUnresolved(host, port), timeoutMillis);
            socks.setSoTimeout(timeoutMillis);
            return new TSocket(socks);
        } catch (Throwable t) {
            closeQuietly(socks);
            throw t;
        }
    } catch (IOException e) {
        throw new TTransportException(e);
    }
}
Also used : TTransportException(org.apache.thrift.transport.TTransportException) TTransport(org.apache.thrift.transport.TTransport) IOException(java.io.IOException) Socket(java.net.Socket) TSocket(org.apache.thrift.transport.TSocket) TSocket(org.apache.thrift.transport.TSocket)

Aggregations

TSocket (org.apache.thrift.transport.TSocket)66 TTransport (org.apache.thrift.transport.TTransport)43 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)41 TProtocol (org.apache.thrift.protocol.TProtocol)36 TFramedTransport (org.apache.thrift.transport.TFramedTransport)33 IOException (java.io.IOException)16 TException (org.apache.thrift.TException)16 TTransportException (org.apache.thrift.transport.TTransportException)15 TCompactProtocol (org.apache.thrift.protocol.TCompactProtocol)9 Cassandra (org.apache.cassandra.thrift.Cassandra)5 ImageDatasetService (org.vcell.imagedataset.ImageDatasetService)5 Socket (java.net.Socket)4 SocketException (java.net.SocketException)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Hello (org.tech.model.Hello)4 ImageDataset (cbit.vcell.VirtualMicroscopy.ImageDataset)3 ByteBuffer (java.nio.ByteBuffer)3 SSLSocket (javax.net.ssl.SSLSocket)3 TBinaryProtocol (org.apache.cassandra.thrift.TBinaryProtocol)3