private com.facebook.swift.service.ResultCode logSwift( int port, List<com.facebook.swift.service.LogEntry> entries) throws Exception { try (ThriftClientManager clientManager = new ThriftClientManager(); Scribe scribe = clientManager .createClient(new FramedClientConnector(fromParts("localhost", port)), Scribe.class) .get()) { return scribe.log(entries); } }
/** * * Asynchronously connect to a service to create a new client * * @param connector Connector used to establish the new connection * @return Future that will be set to the client once the connection is established */ public ListenableFuture<T> open(NiftyClientConnector<? extends NiftyClientChannel> connector) { return clientManager.createClient( connector, clientType, connectTimeout, readTimeout, writeTimeout, maxFrameSize, clientName, socksProxy); }
/** * * Create a new client from an existing connection * * @param channel Established client connection * @return The new client */ public T open(NiftyClientChannel channel) { return clientManager.createClient(channel, clientType, clientName); }