org.apache.thrift.transport.TFastFramedTransport Java Examples
The following examples show how to use
org.apache.thrift.transport.TFastFramedTransport.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppenderUtils.java From singer with Apache License 2.0 | 5 votes |
@Override public void init(OutputStream os) { this.os = os; // Use the TFlushingFastFramedTransport to be compatible with singer_thrift // log. final int bufferCapacity = 10; framedTransport = new TFastFramedTransport(new TIOStreamTransport(os), bufferCapacity); protocol = new TBinaryProtocol(framedTransport); }
Example #2
Source File: IoTDBConnection.java From incubator-iotdb with Apache License 2.0 | 5 votes |
private void openTransport() throws TTransportException { transport = new TFastFramedTransport(new TSocket(params.getHost(), params.getPort(), Config.connectionTimeoutInMs)); if (!transport.isOpen()) { transport.open(); } }
Example #3
Source File: Main.java From jbender with Apache License 2.0 | 5 votes |
@Suspendable public static void main(String[] args) throws Exception { EchoService.Processor<EchoService.Iface> processor = new EchoService.Processor<EchoService.Iface>(new EchoServiceImpl()); TFiberServerSocket trans = new TFiberServerSocket(new InetSocketAddress(9999)); TFiberServer.Args targs = new TFiberServer.Args(trans, processor) .protocolFactory(new TBinaryProtocol.Factory()) .transportFactory(new TFastFramedTransport.Factory()); TFiberServer server = new TFiberServer(targs); server.serve(); server.join(); }
Example #4
Source File: Main.java From jbender with Apache License 2.0 | 5 votes |
@Override public EchoResponse execute(long l, EchoRequest echoRequest) throws SuspendExecution, InterruptedException { try { TProtocol proto = new TBinaryProtocol(new TFastFramedTransport(TFiberSocket.open(new InetSocketAddress("localhost", 9999)))); EchoService.Client client = new EchoService.Client(proto); return client.echo(echoRequest); } catch (Exception ex) { LOG.error("failed to echo", ex); throw new RuntimeException(ex); } }
Example #5
Source File: ThriftRpcClient.java From mt-flume with Apache License 2.0 | 5 votes |
public ClientWrapper() throws Exception{ transport = new TFastFramedTransport(new TSocket(hostname, port)); transport.open(); client = new ThriftSourceProtocol.Client(new TCompactProtocol (transport)); // Not a great hash code, but since this class is immutable and there // is at most one instance of the components of this class, // this works fine [If the objects are equal, hash code is the same] hashCode = random.nextInt(); }