Package org.apache.pinot.query.mailbox
Class ReceivingMailbox
- java.lang.Object
-
- org.apache.pinot.query.mailbox.ReceivingMailbox
-
public class ReceivingMailbox extends Object
Mailbox that's used to receive data. Ownership of the ReceivingMailbox is with the MailboxService, which is unlike theSendingMailboxwhose ownership lies with the send operator. This is because the ReceivingMailbox can be initialized even before the corresponding OpChain is registered on the receiver, whereas the SendingMailbox is initialized when the send operator is running.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceReceivingMailbox.Readerstatic classReceivingMailbox.ReceivingMailboxStatus
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_PENDING_BLOCKS
-
Constructor Summary
Constructors Constructor Description ReceivingMailbox(String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancels the mailbox.StringgetId()intgetNumPendingBlocks()ReceivingMailbox.ReceivingMailboxStatusoffer(TransferableBlock block, long timeoutMs)Offers a non-error block into the mailbox within the timeout specified, returns whether the block is successfully added.TransferableBlockpoll()Returns the first block from the mailbox, ornullif there is no block received yet.voidregisteredReader(ReceivingMailbox.Reader reader)voidsetErrorBlock(TransferableBlock errorBlock)Sets an error block into the mailbox.
-
-
-
Field Detail
-
DEFAULT_MAX_PENDING_BLOCKS
public static final int DEFAULT_MAX_PENDING_BLOCKS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ReceivingMailbox
public ReceivingMailbox(String id)
-
-
Method Detail
-
registeredReader
public void registeredReader(ReceivingMailbox.Reader reader)
-
getId
public String getId()
-
offer
public ReceivingMailbox.ReceivingMailboxStatus offer(TransferableBlock block, long timeoutMs)
Offers a non-error block into the mailbox within the timeout specified, returns whether the block is successfully added. If the block is not added, an error block is added to the mailbox.
-
setErrorBlock
public void setErrorBlock(TransferableBlock errorBlock)
Sets an error block into the mailbox. No more blocks are accepted after calling this method.
-
poll
@Nullable public TransferableBlock poll()
Returns the first block from the mailbox, ornullif there is no block received yet. Error block is returned if exists.
-
cancel
public void cancel()
Cancels the mailbox. No more blocks are accepted after calling this method. Should only be called by the receive operator to clean up the remaining blocks.
-
getNumPendingBlocks
public int getNumPendingBlocks()
-
-