Package org.apache.pinot.query.mailbox
Class GrpcSendingMailbox
- java.lang.Object
-
- org.apache.pinot.query.mailbox.GrpcSendingMailbox
-
- All Implemented Interfaces:
SendingMailbox
public class GrpcSendingMailbox extends Object implements SendingMailbox
gRPC implementation of theSendingMailbox. The gRPC stream is created on the first call tosend(org.apache.pinot.query.runtime.blocks.TransferableBlock).
-
-
Constructor Summary
Constructors Constructor Description GrpcSendingMailbox(String id, ChannelManager channelManager, String hostname, int port, long deadlineMs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel(Throwable t)Cancels the mailbox and notifies the receiver of the cancellation so that it can release the underlying resources.voidcomplete()Called when there is no more data to be sent by theBlockExchange.booleanisTerminated()Returns whether theReceivingMailboxis already closed.voidsend(TransferableBlock block)Sends a block to the receiver.
-
-
-
Constructor Detail
-
GrpcSendingMailbox
public GrpcSendingMailbox(String id, ChannelManager channelManager, String hostname, int port, long deadlineMs)
-
-
Method Detail
-
send
public void send(TransferableBlock block) throws IOException
Description copied from interface:SendingMailboxSends a block to the receiver. Note that SendingMailbox are required to acquire resources lazily in this call, and they should not acquire any resources when they are created. This method should throw if there was an error sending the data, since that would allowBlockExchangeto exit early.- Specified by:
sendin interfaceSendingMailbox- Throws:
IOException
-
complete
public void complete()
Description copied from interface:SendingMailboxCalled when there is no more data to be sent by theBlockExchange. This is also a signal for the SendingMailbox that the sender is done sending data from its end. Note that this doesn't mean that the receiver has received all the data.Note: While this is similar to a close() method that's usually provided with objects that hold releasable resources, the key difference is that a SendingMailbox cannot completely release the resources on its end gracefully, since it would be waiting for the receiver to ack that it has received all the data. See
SendingMailbox.cancel(java.lang.Throwable)which can allow callers to force release the underlying resources.- Specified by:
completein interfaceSendingMailbox
-
cancel
public void cancel(Throwable t)
Description copied from interface:SendingMailboxCancels the mailbox and notifies the receiver of the cancellation so that it can release the underlying resources. No more blocks can be sent after calling this method.- Specified by:
cancelin interfaceSendingMailbox
-
isTerminated
public boolean isTerminated()
Description copied from interface:SendingMailboxReturns whether theReceivingMailboxis already closed. There is no need to send more blocks after the mailbox is terminated.- Specified by:
isTerminatedin interfaceSendingMailbox
-
-