Class StateConsumerImpl

    • Field Detail


        protected static final int NO_STATE_TRANSFER_IN_PROGRESS
        See Also:
        Constant Field Values

        protected static final long STATE_TRANSFER_FLAGS
      • cache

        protected org.infinispan.factories.impl.ComponentRef<Cache> cache
      • commandsFactory

        protected org.infinispan.commands.CommandsFactory commandsFactory
      • transactionTable

        protected org.infinispan.transaction.impl.TransactionTable transactionTable
      • dataContainer

        protected org.infinispan.container.impl.InternalDataContainer<Object,​Object> dataContainer
      • cacheName

        protected String cacheName
      • timeout

        protected long timeout
      • isFetchEnabled

        protected boolean isFetchEnabled
      • isTransactional

        protected boolean isTransactional
      • isInvalidationMode

        protected boolean isInvalidationMode
      • isTotalOrder

        protected boolean isTotalOrder
      • stateTransferTopologyId

        protected final AtomicInteger stateTransferTopologyId
        Indicates if there is a state transfer in progress. It is set to the new topology id when onTopologyUpdate with isRebalance==true is called. It is changed back to NO_REBALANCE_IN_PROGRESS when a topology update with a null pending CH is received.
      • waitingForState

        protected final AtomicBoolean waitingForState
        Indicates if there is a rebalance in progress and there the local node has not yet received all the new segments yet. It is set to true when rebalance starts and becomes when all inbound transfers have completed (before stateTransferTopologyId is set back to NO_REBALANCE_IN_PROGRESS).
      • transferMapsLock

        protected final Object transferMapsLock
      • transfersBySegment

        protected final Map<Integer,​List<InboundTransferTask>> transfersBySegment
        A map that keeps track of current inbound state transfers by segment id. There is at most one transfers per segment. This works in tandem with transfersBySource so they always need to be kept in sync and updates to both of them need to be atomic.
      • stateRequestExecutor

        protected LimitedExecutor stateRequestExecutor
        Push RPCs on a background thread
    • Constructor Detail

      • StateConsumerImpl

        public StateConsumerImpl()
    • Method Detail

      • stopApplyingState

        public void stopApplyingState​(int topologyId)
        Stops applying incoming state. Also stops tracking updated keys. Should be called at the end of state transfer or when a ClearCommand is committed during state transfer.
        Specified by:
        stopApplyingState in interface StateConsumer
      • hasActiveTransfers

        public boolean hasActiveTransfers()
      • ownsData

        public boolean ownsData()
        Specified by:
        ownsData in interface StateConsumer
        true if this node has already received the first rebalance command
      • onTopologyUpdate

        public CompletableFuture<Void> onTopologyUpdate​(CacheTopology cacheTopology,
                                                        boolean isRebalance)
        Description copied from interface: StateConsumer
        Receive notification of topology changes. StateRequestCommands are issued for segments that are new to this member and the segments that are no longer owned are discarded.
        Specified by:
        onTopologyUpdate in interface StateConsumer
        future that is completed when the state transfer has finished
      • beforeTopologyInstalled

        protected void beforeTopologyInstalled​(int topologyId,
                                               boolean startRebalance,
                                               ConsistentHash previousWriteCh,
                                               ConsistentHash newWriteCh)
      • handleSegments

        protected void handleSegments​(boolean startRebalance,
                                      IntSet addedSegments,
                                      IntSet removedSegments)
      • notifyEndOfStateTransferIfNeeded

        protected boolean notifyEndOfStateTransferIfNeeded()
      • start

        public void start()
      • stop

        public void stop()
        Description copied from interface: StateConsumer
        Cancels all incoming state transfers. The already received data is not discarded. This is executed when the cache is shutting down.
        Specified by:
        stop in interface StateConsumer
      • cancelTransfers

        protected void cancelTransfers​(IntSet removedSegments)
        Cancel transfers for segments we no longer own.
        removedSegments - segments to be cancelled