public static StreamRequest decode(ByteBuf buf) { String streamId = Encoders.Strings.decode(buf); return new StreamRequest(streamId); }
return StreamRequest.decode(in);
return StreamRequest.decode(in);
public static StreamRequest decode(ByteBuf buf) { String streamId = Encoders.Strings.decode(buf); return new StreamRequest(streamId); }
return StreamRequest.decode(in);
public static StreamRequest decode(ByteBuf buf) { String streamId = Encoders.Strings.decode(buf); return new StreamRequest(streamId); }
return StreamRequest.decode(in);
public static StreamRequest decode(ByteBuf buf) { String streamId = Encoders.Strings.decode(buf); return new StreamRequest(streamId); }
/** * Request to stream the data with the given stream ID from the remote end. * * @param streamId The stream to fetch. * @param callback Object to call with the stream data. */ public void stream(String streamId, StreamCallback callback) { StdChannelListener listener = new StdChannelListener(streamId) { @Override void handleFailure(String errorMsg, Throwable cause) throws Exception { callback.onFailure(streamId, new IOException(errorMsg, cause)); } }; if (logger.isDebugEnabled()) { logger.debug("Sending stream request for {} to {}", streamId, getRemoteAddress(channel)); } // Need to synchronize here so that the callback is added to the queue and the RPC is // written to the socket atomically, so that callbacks are called in the right order // when responses arrive. synchronized (this) { handler.addStreamCallback(streamId, callback); channel.writeAndFlush(new StreamRequest(streamId)).addListener(listener); } }
/** * Request to stream the data with the given stream ID from the remote end. * * @param streamId The stream to fetch. * @param callback Object to call with the stream data. */ public void stream(String streamId, StreamCallback callback) { StdChannelListener listener = new StdChannelListener(streamId) { @Override void handleFailure(String errorMsg, Throwable cause) throws Exception { callback.onFailure(streamId, new IOException(errorMsg, cause)); } }; if (logger.isDebugEnabled()) { logger.debug("Sending stream request for {} to {}", streamId, getRemoteAddress(channel)); } // Need to synchronize here so that the callback is added to the queue and the RPC is // written to the socket atomically, so that callbacks are called in the right order // when responses arrive. synchronized (this) { handler.addStreamCallback(streamId, callback); channel.writeAndFlush(new StreamRequest(streamId)).addListener(listener); } }
channel.writeAndFlush(new StreamRequest(streamId)).addListener(future -> { if (future.isSuccess()) { long timeTaken = System.currentTimeMillis() - startTime;
channel.writeAndFlush(new StreamRequest(streamId)).addListener( new ChannelFutureListener() { @Override
RequestMessage request2 = new StreamRequest(String.format("%d_%d", streamId, 2)); requestHandler.handle(request2); assert responseAndPromisePairs.size() == 3; RequestMessage request3 = new StreamRequest(String.format("%d_%d", streamId, 3)); requestHandler.handle(request3); verify(channel, times(1)).close();
@Test public void requests() { testClientToServer(new ChunkFetchRequest(new StreamChunkId(1, 2))); testClientToServer(new RpcRequest(12345, new TestManagedBuffer(0))); testClientToServer(new RpcRequest(12345, new TestManagedBuffer(10))); testClientToServer(new StreamRequest("abcde")); testClientToServer(new OneWayMessage(new TestManagedBuffer(10))); }
@Test public void requests() { testClientToServer(new ChunkFetchRequest(new StreamChunkId(1, 2))); testClientToServer(new RpcRequest(12345, new TestManagedBuffer(0))); testClientToServer(new RpcRequest(12345, new TestManagedBuffer(10))); testClientToServer(new StreamRequest("abcde")); testClientToServer(new OneWayMessage(new TestManagedBuffer(10))); }