Class SinkHandle

  • All Implemented Interfaces:
    ISinkHandle

    public class SinkHandle
    extends java.lang.Object
    implements ISinkHandle
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int MAX_ATTEMPT_TIMES  
    • Constructor Summary

      Constructors 
      Constructor Description
      SinkHandle​(org.apache.iotdb.common.rpc.thrift.TEndPoint remoteEndpoint, org.apache.iotdb.mpp.rpc.thrift.TFragmentInstanceId remoteFragmentInstanceId, java.lang.String remotePlanNodeId, org.apache.iotdb.mpp.rpc.thrift.TFragmentInstanceId localFragmentInstanceId, LocalMemoryManager localMemoryManager, java.util.concurrent.ExecutorService executorService, org.apache.iotdb.tsfile.read.common.block.column.TsBlockSerde serde, MPPDataExchangeManager.SinkHandleListener sinkHandleListener, org.apache.iotdb.commons.client.IClientManager<org.apache.iotdb.common.rpc.thrift.TEndPoint,​org.apache.iotdb.commons.client.sync.SyncDataNodeMPPDataExchangeServiceClient> mppDataExchangeServiceClientManager)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void abort()
      Abort the sink handle.
      void close()
      Close the sink handle.
      long getBufferRetainedSizeInBytes()
      Get the total amount of memory used by buffered tsblocks.
      org.apache.iotdb.mpp.rpc.thrift.TFragmentInstanceId getLocalFragmentInstanceId()
      Get the local fragment instance ID that this sink handle belongs to.
      int getNumOfBufferedTsBlocks()  
      org.apache.iotdb.common.rpc.thrift.TEndPoint getRemoteEndpoint()  
      org.apache.iotdb.mpp.rpc.thrift.TFragmentInstanceId getRemoteFragmentInstanceId()  
      java.lang.String getRemotePlanNodeId()  
      boolean isAborted()
      If the handle is aborted.
      boolean isFinished()
      If there are no more tsblocks to be sent and all the tsblocks have been fetched by downstream fragment instances.
      com.google.common.util.concurrent.ListenableFuture<?> isFull()
      Get a future that will be completed when the output buffer is not full.
      void send​(int partition, java.util.List<org.apache.iotdb.tsfile.read.common.block.TsBlock> tsBlocks)
      Send a TsBlock to a specific partition.
      void send​(org.apache.iotdb.tsfile.read.common.block.TsBlock tsBlock)
      Send a list of tsblocks to an unpartitioned output buffer.
      void setNoMoreTsBlocks()
      Notify the handle that there are no more tsblocks.
      void setRetryIntervalInMs​(long retryIntervalInMs)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SinkHandle

        public SinkHandle​(org.apache.iotdb.common.rpc.thrift.TEndPoint remoteEndpoint,
                          org.apache.iotdb.mpp.rpc.thrift.TFragmentInstanceId remoteFragmentInstanceId,
                          java.lang.String remotePlanNodeId,
                          org.apache.iotdb.mpp.rpc.thrift.TFragmentInstanceId localFragmentInstanceId,
                          LocalMemoryManager localMemoryManager,
                          java.util.concurrent.ExecutorService executorService,
                          org.apache.iotdb.tsfile.read.common.block.column.TsBlockSerde serde,
                          MPPDataExchangeManager.SinkHandleListener sinkHandleListener,
                          org.apache.iotdb.commons.client.IClientManager<org.apache.iotdb.common.rpc.thrift.TEndPoint,​org.apache.iotdb.commons.client.sync.SyncDataNodeMPPDataExchangeServiceClient> mppDataExchangeServiceClientManager)
    • Method Detail

      • isFull

        public com.google.common.util.concurrent.ListenableFuture<?> isFull()
        Description copied from interface: ISinkHandle
        Get a future that will be completed when the output buffer is not full.
        Specified by:
        isFull in interface ISinkHandle
      • send

        public void send​(org.apache.iotdb.tsfile.read.common.block.TsBlock tsBlock)
        Description copied from interface: ISinkHandle
        Send a list of tsblocks to an unpartitioned output buffer. If no-more-tsblocks has been set, the invocation will be ignored. This can happen with limit queries. A RuntimeException will be thrown if any exception happened during the data transmission.
        Specified by:
        send in interface ISinkHandle
      • send

        public void send​(int partition,
                         java.util.List<org.apache.iotdb.tsfile.read.common.block.TsBlock> tsBlocks)
        Description copied from interface: ISinkHandle
        Send a TsBlock to a specific partition. If no-more-tsblocks has been set, the send tsblock call is ignored. This can happen with limit queries. A RuntimeException will be thrown if any exception happened * during the data transmission.
        Specified by:
        send in interface ISinkHandle
      • setNoMoreTsBlocks

        public void setNoMoreTsBlocks()
        Description copied from interface: ISinkHandle
        Notify the handle that there are no more tsblocks. Any future calls to send a tsblock should be ignored.
        Specified by:
        setNoMoreTsBlocks in interface ISinkHandle
      • abort

        public void abort()
        Description copied from interface: ISinkHandle
        Abort the sink handle. Discard all tsblocks which may still be in the memory buffer and cancel the future returned by ISinkHandle.isFull().

        Should only be called in abnormal case

        Specified by:
        abort in interface ISinkHandle
      • close

        public void close()
        Description copied from interface: ISinkHandle
        Close the sink handle. Discard all tsblocks which may still be in the memory buffer and complete the future returned by ISinkHandle.isFull().

        Should only be called in normal case.

        Specified by:
        close in interface ISinkHandle
      • isAborted

        public boolean isAborted()
        Description copied from interface: ISinkHandle
        If the handle is aborted.
        Specified by:
        isAborted in interface ISinkHandle
      • isFinished

        public boolean isFinished()
        Description copied from interface: ISinkHandle
        If there are no more tsblocks to be sent and all the tsblocks have been fetched by downstream fragment instances.
        Specified by:
        isFinished in interface ISinkHandle
      • getBufferRetainedSizeInBytes

        public long getBufferRetainedSizeInBytes()
        Description copied from interface: ISinkHandle
        Get the total amount of memory used by buffered tsblocks.
        Specified by:
        getBufferRetainedSizeInBytes in interface ISinkHandle
      • getNumOfBufferedTsBlocks

        public int getNumOfBufferedTsBlocks()
      • getRemoteEndpoint

        public org.apache.iotdb.common.rpc.thrift.TEndPoint getRemoteEndpoint()
      • getRemoteFragmentInstanceId

        public org.apache.iotdb.mpp.rpc.thrift.TFragmentInstanceId getRemoteFragmentInstanceId()
      • getRemotePlanNodeId

        public java.lang.String getRemotePlanNodeId()
      • getLocalFragmentInstanceId

        public org.apache.iotdb.mpp.rpc.thrift.TFragmentInstanceId getLocalFragmentInstanceId()
        Description copied from interface: ISinkHandle
        Get the local fragment instance ID that this sink handle belongs to.
        Specified by:
        getLocalFragmentInstanceId in interface ISinkHandle
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setRetryIntervalInMs

        public void setRetryIntervalInMs​(long retryIntervalInMs)