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;
}
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);
}
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;
}
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);
}
}
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);
}
}
Aggregations