Java Code Examples for org.apache.thrift.transport.TSocket#close()
The following examples show how to use
org.apache.thrift.transport.TSocket#close() .
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: TestApacheThriftMethodInvoker.java From drift with Apache License 2.0 | 6 votes |
private static int logThrift(HostAndPort address, List<LogEntry> messages) { try { TSocket socket = new TSocket(address.getHost(), address.getPort()); socket.open(); try { TBinaryProtocol tp = new TBinaryProtocol(new TFramedTransport(socket)); assertEquals(new scribe.Client(tp).Log(messages), ResultCode.OK); } finally { socket.close(); } } catch (TException e) { throw new RuntimeException(e); } return 1; }
Example 2
Source File: ExcepClient.java From ThriftBook with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws TException { TSocket trans = new TSocket("localhost", 9090); TBinaryProtocol proto = new TBinaryProtocol(trans); TradeHistory.Client client = new TradeHistory.Client(proto); try { trans.open(); double price = client.GetLastSale(args[0]); System.out.println("[Client] received: " + price); } catch (BadFish bf) { System.out.println("[Client] GetLastSale() call failed for fish: " + bf.fish + ", error " + bf.error_code); } trans.close(); }
Example 3
Source File: HelloClient.java From ThriftBook with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws TException { TSocket trans = new TSocket("localhost", 9090); TBinaryProtocol proto = new TBinaryProtocol(trans); HelloSvc.Client client = new HelloSvc.Client(proto); trans.open(); String str = client.hello_func(); System.out.println("[Client] received: " + str); trans.close(); }
Example 4
Source File: HelloClient.java From ThriftBook with Apache License 2.0 | 5 votes |
public static void main(String[] args) { TSocket trans = new TSocket("localhost", 9090); TBinaryProtocol proto = new TBinaryProtocol(trans); helloSvc.Client client = new helloSvc.Client(proto); try { trans.open(); String str = client.getMessage("world"); System.out.println("[Client] received: " + str); } catch (TException ex) { System.out.println("Error: " + ex.toString()); } trans.close(); }
Example 5
Source File: HelloClient.java From ThriftBook with Apache License 2.0 | 5 votes |
public static void main(String[] args) { TSocket trans = new TSocket("localhost", 9090); TBinaryProtocol proto = new TBinaryProtocol(trans); helloSvc.Client client = new helloSvc.Client(proto); try { trans.open(); String str = client.getMessage("world"); System.out.println("[Client] received: " + str); } catch (TException ex) { System.out.println("Error: " + ex.toString()); } trans.close(); }
Example 6
Source File: ThriftClient.java From ThriftBook with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws IOException, TException { TSocket trans = new TSocket("localhost", 9090); TJSONProtocol proto = new TJSONProtocol(trans); TradeHistory.Client client = new TradeHistory.Client(proto); trans.open(); for (int i = 0; i < 1000000; i++) { TradeReport tr = client.get_last_sale("APPL"); } trans.close(); }
Example 7
Source File: ThriftClient.java From ThriftBook with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws IOException, TException { TSocket trans = new TSocket("localhost", 9090); TBinaryProtocol proto = new TBinaryProtocol(trans); TradeHistory.Client client = new TradeHistory.Client(proto); trans.open(); for (int i = 0; i < 1000000; i++) { TradeReport tr = client.get_last_sale("APPL"); } trans.close(); }
Example 8
Source File: SocketObjectFactory.java From rubix with Apache License 2.0 | 4 votes |
@Override public void destroy(TSocket o) { // clean up and release resources o.close(); }