NettyBlockRpcServer is an RpcHandler to handle messages for NettyBlockTransferService.

Figure 1. NettyBlockRpcServer and NettyBlockTransferService

Creating Instance

NettyBlockRpcServer takes the following to be created:

NettyBlockRpcServer is created when NettyBlockTransferService is requested to initialize.


NettyBlockRpcServer uses a OneForOneStreamManager for…​FIXME

Receiving RPC Messages

  client: TransportClient,
  rpcMessage: ByteBuffer,
  responseContext: RpcResponseCallback): Unit


receive is part of RpcHandler abstraction.

NettyBlockRpcServer Messages

OpenBlocks Message Handler

When OpenBlocks arrives, NettyBlockRpcServer requests the BlockDataManager for block data for every block id in the message. The block data is a collection of ManagedBuffer for every block id in the incoming message.

The internal StreamManager is OneForOneStreamManager and is created when NettyBlockRpcServer is created.

You should see the following TRACE message in the logs:

NettyBlockRpcServer: Registered streamId [streamId]  with [size] buffers

In the end, NettyBlockRpcServer responds with a StreamHandle (with the streamId and the number of blocks). The response is serialized as a ByteBuffer.

UploadBlock Message Handler

When UploadBlock arrives, NettyBlockRpcServer deserializes the metadata of the input message to get the StorageLevel and ClassTag of the block being uploaded.

NettyBlockRpcServer creates a BlockId for the block id and requests the BlockDataManager to store the block.

In the end, NettyBlockRpcServer responds with a 0-capacity ByteBuffer.

UploadBlock is sent when NettyBlockTransferService is requested to upload a block.

Receiving RPC Message with Streamed Data

  client: TransportClient,
  messageHeader: ByteBuffer,
  responseContext: RpcResponseCallback): StreamCallbackWithID


receiveStream is part of RpcHandler abstraction.


Enable ALL logging level for logger to see what happens inside.

Add the following line to conf/

Refer to Logging.