Package org.apache.pinot.query.mailbox
Class MailboxService
- java.lang.Object
-
- org.apache.pinot.query.mailbox.MailboxService
-
public class MailboxService extends Object
Mailbox service that handles data transfer.
-
-
Constructor Summary
Constructors Constructor Description MailboxService(String hostname, int port, org.apache.pinot.spi.env.PinotConfiguration config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetHostname()intgetPort()ReceivingMailboxgetReceivingMailbox(String mailboxId)Returns the receiving mailbox for the given mailbox id.SendingMailboxgetSendingMailbox(String hostname, int port, String mailboxId, long deadlineMs)Returns a sending mailbox for the given mailbox id.voidreleaseReceivingMailbox(ReceivingMailbox mailbox)Releases the receiving mailbox from the cache.voidshutdown()Shuts down the mailbox service.voidstart()Starts the mailbox service.
-
-
-
Constructor Detail
-
MailboxService
public MailboxService(String hostname, int port, org.apache.pinot.spi.env.PinotConfiguration config)
-
-
Method Detail
-
start
public void start()
Starts the mailbox service.
-
shutdown
public void shutdown()
Shuts down the mailbox service.
-
getHostname
public String getHostname()
-
getPort
public int getPort()
-
getSendingMailbox
public SendingMailbox getSendingMailbox(String hostname, int port, String mailboxId, long deadlineMs)
Returns a sending mailbox for the given mailbox id. The returned sending mailbox is uninitialized, i.e. it will not open the underlying channel or acquire any additional resources. Instead, it will initialize lazily when the data is sent for the first time.
-
getReceivingMailbox
public ReceivingMailbox getReceivingMailbox(String mailboxId)
Returns the receiving mailbox for the given mailbox id.
-
releaseReceivingMailbox
public void releaseReceivingMailbox(ReceivingMailbox mailbox)
Releases the receiving mailbox from the cache. The receiving mailbox for a given OpChain may be created before the OpChain is even registered. Reason being that the sender starts sending data, and the receiver starts receiving the same without waiting for the OpChain to be registered. The ownership for the ReceivingMailbox hence lies with the MailboxService and not the OpChain. We can safely release a receiving mailbox when all the data are received and processed by the OpChain. If there might be data not received yet, we should not release the receiving mailbox to prevent a new receiving mailbox being created.
-
-