Class GrpcSendingMailbox

    • 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: SendingMailbox
        Sends 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 allow BlockExchange to exit early.
        Specified by:
        send in interface SendingMailbox
        Throws:
        IOException
      • complete

        public void complete()
        Description copied from interface: SendingMailbox
        Called when there is no more data to be sent by the BlockExchange. 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:
        complete in interface SendingMailbox
      • cancel

        public void cancel​(Throwable t)
        Description copied from interface: SendingMailbox
        Cancels 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:
        cancel in interface SendingMailbox
      • isTerminated

        public boolean isTerminated()
        Description copied from interface: SendingMailbox
        Returns whether the ReceivingMailbox is already closed. There is no need to send more blocks after the mailbox is terminated.
        Specified by:
        isTerminated in interface SendingMailbox