List of usage examples for org.apache.thrift.transport TFastFramedTransport TFastFramedTransport
public TFastFramedTransport(TTransport underlying)
From source file:com.pinterest.echo.client.Main.java
License:Apache License
public static void main(String[] args) throws Exception { Fiber<Void> f = new Fiber<Void>(new SuspendableRunnable() { @Override/*ww w . j a v a 2s .c om*/ public void run() throws SuspendExecution, InterruptedException { try { TProtocol protocol = new TBinaryProtocol( new TFastFramedTransport(TFiberSocket.open(new InetSocketAddress(9999)))); EchoService.Client client = new EchoService.Client(protocol); EchoResponse response = client.echo(new EchoRequest().setMessage("hello, world")); System.out.println(response); } catch (Exception ex) { ex.printStackTrace(); } } }).start(); f.join(); }
From source file:com.pinterest.example.client.Main.java
License:Apache License
public static void main(String[] args) throws Exception { Fiber<Void> f = new Fiber<Void>(new SuspendableRunnable() { @Override// w w w .ja v a 2 s. c o m public void run() throws SuspendExecution, InterruptedException { try { TProtocol protocol = new TBinaryProtocol( new TFastFramedTransport(TFiberSocket.open(new InetSocketAddress(9999)))); ExampleService.Client client = new ExampleService.Client(protocol); ExampleResponse response = client .example(new ExampleRequest().setExampleEnum(ExampleEnum.VALUE_ONE)); System.out.println(response); } catch (Exception ex) { ex.printStackTrace(); } } }).start(); f.join(); }
From source file:com.vmware.photon.controller.housekeeper.helpers.TestHelper.java
License:Open Source License
public static Housekeeper.Client createLocalThriftClient(TestInjectedConfig config) throws TTransportException, InterruptedException, TimeoutException { long timeLeft = CONNECTION_TIMEOUT_IN_MS; TSocket socket = new TSocket(config.getThriftBindAddress(), config.getThriftPort()); while (true) { if (timeLeft <= 0) { throw new TimeoutException(); }//from w w w.ja v a2 s . c om timeLeft -= CONNECTION_RETRY_INTERVAL_IN_MS; try { socket.open(); } catch (TTransportException e) { Thread.sleep(CONNECTION_RETRY_INTERVAL_IN_MS); continue; } break; } return new Housekeeper.Client(new TMultiplexedProtocol( new TCompactProtocol(new TFastFramedTransport(socket)), HousekeeperServer.SERVICE_NAME)); }
From source file:com.vmware.transfer.nfc.ImageUploadTool.java
License:Open Source License
private void init() throws TTransportException { TTransport transport = new TFastFramedTransport(new TSocket(hostAddress, hostPort)); transport.open();//from w w w.j a v a2s . c o m TProtocol proto = new TCompactProtocol(transport); TMultiplexedProtocol mproto = new TMultiplexedProtocol(proto, "Host"); hostClient = new Host.Client(mproto); }
From source file:io.fluo.core.oracle.OracleServer.java
License:Apache License
private OracleService.Client getOracleClient(String host, int port) { try {//w w w . j av a 2 s . c o m TTransport transport = new TFastFramedTransport(new TSocket(host, port)); transport.open(); TProtocol protocol = new TCompactProtocol(transport); log.info("Former leader was reachable at " + host + ":" + port); return new OracleService.Client(protocol); } catch (TTransportException e) { } catch (Exception e) { throw new RuntimeException(e); } return null; }
From source file:org.apache.cassandra.tools.Shuffle.java
License:Apache License
CassandraClient(String hostName, int port, boolean framed) throws TTransportException { TSocket socket = new TSocket(hostName, port); transport = (framed) ? socket : new TFastFramedTransport(socket); transport.open();/*ww w . j av a 2 s.com*/ client = new Cassandra.Client(new TBinaryProtocol(transport)); try { client.set_cql_version("3.0.0"); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:org.apache.flume.api.ThriftRpcClient.java
License:Apache License
protected TTransport getTransport(TSocket tsocket) throws Exception { return new TFastFramedTransport(tsocket); }
From source file:org.apache.fluo.core.oracle.OracleServer.java
License:Apache License
private OracleService.Client getOracleClient(String host, int port) { try {//w w w . jav a 2 s.c o m TTransport transport = new TFastFramedTransport(new TSocket(host, port)); transport.open(); TProtocol protocol = new TCompactProtocol(transport); log.info("Former leader was reachable at " + host + ":" + port); return new OracleService.Client(protocol); } catch (TTransportException e) { log.debug("Exception thrown in getOracleClient()", e); } catch (Exception e) { throw new RuntimeException(e); } return null; }