Class ShardCoordinator

    • Method Detail

      • leastShardAllocationStrategy

        public static ShardCoordinator.ShardAllocationStrategy leastShardAllocationStrategy​(int absoluteLimit,
                                                                                            double relativeLimit)
        Java API: ShardAllocationStrategy that allocates new shards to the ShardRegion (node) with least number of previously allocated shards.

        When a node is added to the cluster the shards on the existing nodes will be rebalanced to the new node. The LeastShardAllocationStrategy picks shards for rebalancing from the ShardRegions with most number of previously allocated shards. They will then be allocated to the ShardRegion with least number of previously allocated shards, i.e. new members in the cluster. The amount of shards to rebalance in each round can be limited to make it progress slower since rebalancing too many shards at the same time could result in additional load on the system. For example, causing many Event Sourced entites to be started at the same time.

        It will not rebalance when there is already an ongoing rebalance in progress.

        Parameters:
        absoluteLimit - the maximum number of shards that will be rebalanced in one rebalance round
        relativeLimit - fraction (< 1.0) of total number of (known) shards that will be rebalanced in one rebalance round
      • context

        public ActorContext context()
        Description copied from interface: Actor
        Scala API: Stores the context for this actor, including self, and sender. It is implicit to support operations such as forward.

        WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!

        ActorContext is the Scala API. getContext returns a AbstractActor.ActorContext, which is the Java API of the actor context.

        Specified by:
        context in interface Actor
      • self

        public final ActorRef self()
        Description copied from interface: Actor
        The 'self' field holds the ActorRef for this actor.

        Can be used to send messages to itself:
         self ! message
         
        Specified by:
        self in interface Actor
      • akka$actor$Actor$_setter_$context_$eq

        protected void akka$actor$Actor$_setter_$context_$eq​(ActorContext x$1)
        Description copied from interface: Actor
        Scala API: Stores the context for this actor, including self, and sender. It is implicit to support operations such as forward.

        WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!

        ActorContext is the Scala API. getContext returns a AbstractActor.ActorContext, which is the Java API of the actor context.

        Specified by:
        akka$actor$Actor$_setter_$context_$eq in interface Actor
      • akka$actor$Actor$_setter_$self_$eq

        protected final void akka$actor$Actor$_setter_$self_$eq​(ActorRef x$1)
        Description copied from interface: Actor
        The 'self' field holds the ActorRef for this actor.

        Can be used to send messages to itself:
         self ! message
         
        Specified by:
        akka$actor$Actor$_setter_$self_$eq in interface Actor
      • cluster

        public Cluster cluster()
      • removalMargin

        public scala.concurrent.duration.FiniteDuration removalMargin()
      • minMembers

        public int minMembers()
      • allRegionsRegistered

        public boolean allRegionsRegistered()
      • allRegionsRegistered_$eq

        public void allRegionsRegistered_$eq​(boolean x$1)
      • state

        public akka.cluster.sharding.ShardCoordinator.Internal.State state()
      • state_$eq

        public void state_$eq​(akka.cluster.sharding.ShardCoordinator.Internal.State x$1)
      • preparingForShutdown

        public boolean preparingForShutdown()
      • preparingForShutdown_$eq

        public void preparingForShutdown_$eq​(boolean x$1)
      • rebalanceInProgress

        public scala.collection.immutable.Map<java.lang.String,​scala.collection.immutable.Set<ActorRef>> rebalanceInProgress()
      • rebalanceInProgress_$eq

        public void rebalanceInProgress_$eq​(scala.collection.immutable.Map<java.lang.String,​scala.collection.immutable.Set<ActorRef>> x$1)
      • rebalanceWorkers

        public scala.collection.immutable.Set<ActorRef> rebalanceWorkers()
      • rebalanceWorkers_$eq

        public void rebalanceWorkers_$eq​(scala.collection.immutable.Set<ActorRef> x$1)
      • unAckedHostShards

        public scala.collection.immutable.Map<java.lang.String,​Cancellable> unAckedHostShards()
      • unAckedHostShards_$eq

        public void unAckedHostShards_$eq​(scala.collection.immutable.Map<java.lang.String,​Cancellable> x$1)
      • gracefulShutdownInProgress

        public scala.collection.immutable.Set<ActorRef> gracefulShutdownInProgress()
      • gracefulShutdownInProgress_$eq

        public void gracefulShutdownInProgress_$eq​(scala.collection.immutable.Set<ActorRef> x$1)
      • waitingForLocalRegionToTerminate

        public boolean waitingForLocalRegionToTerminate()
      • waitingForLocalRegionToTerminate_$eq

        public void waitingForLocalRegionToTerminate_$eq​(boolean x$1)
      • aliveRegions

        public scala.collection.immutable.Set<ActorRef> aliveRegions()
      • aliveRegions_$eq

        public void aliveRegions_$eq​(scala.collection.immutable.Set<ActorRef> x$1)
      • regionTerminationInProgress

        public scala.collection.immutable.Set<ActorRef> regionTerminationInProgress()
      • regionTerminationInProgress_$eq

        public void regionTerminationInProgress_$eq​(scala.collection.immutable.Set<ActorRef> x$1)
      • waitingForShardsToStop

        public scala.collection.immutable.Map<java.lang.String,​scala.collection.immutable.Set<scala.Tuple2<ActorRef,​java.util.UUID>>> waitingForShardsToStop()
      • waitingForShardsToStop_$eq

        public void waitingForShardsToStop_$eq​(scala.collection.immutable.Map<java.lang.String,​scala.collection.immutable.Set<scala.Tuple2<ActorRef,​java.util.UUID>>> x$1)
      • typeName

        protected abstract java.lang.String typeName()
      • preStart

        public void preStart()
        Description copied from interface: Actor
        User overridable callback.

        Is called when an Actor is started. Actors are automatically started asynchronously when created. Empty default implementation.
        Specified by:
        preStart in interface Actor
      • postStop

        public void postStop()
        Description copied from interface: Actor
        User overridable callback.

        Is called asynchronously after 'actor.stop()' is invoked. Empty default implementation.
        Specified by:
        postStop in interface Actor
      • isMember

        public boolean isMember​(ActorRef region)
      • active

        public scala.PartialFunction<java.lang.Object,​scala.runtime.BoxedUnit> active()
      • handleGetShardHome

        public boolean handleGetShardHome​(java.lang.String shard)
        Returns:
        true if the message could be handled without state update, i.e. the shard location was known or the request was deferred or ignored
      • receiveTerminated

        public scala.PartialFunction<java.lang.Object,​scala.runtime.BoxedUnit> receiveTerminated()
      • update

        public abstract <E extends akka.cluster.sharding.ShardCoordinator.Internal.DomainEvent> void update​(E evt,
                                                                                                            scala.Function1<E,​scala.runtime.BoxedUnit> f)
      • watchStateActors

        public void watchStateActors()
      • stateInitialized

        public void stateInitialized()
      • hasAllRegionsRegistered

        public boolean hasAllRegionsRegistered()
      • regionTerminated

        public void regionTerminated​(ActorRef ref)
      • regionProxyTerminated

        public void regionProxyTerminated​(ActorRef ref)
      • shuttingDown

        public scala.PartialFunction<java.lang.Object,​scala.runtime.BoxedUnit> shuttingDown()
      • sendHostShardMsg

        public void sendHostShardMsg​(java.lang.String shard,
                                     ActorRef region)
      • allocateShardHomesForRememberEntities

        public void allocateShardHomesForRememberEntities()
      • continueGetShardHome

        public void continueGetShardHome​(java.lang.String shard,
                                         ActorRef region,
                                         ActorRef getShardHomeSender)
      • unstashOneGetShardHomeRequest

        protected abstract void unstashOneGetShardHomeRequest()
      • continueRebalance

        public void continueRebalance​(scala.collection.immutable.Set<java.lang.String> shards)
      • shutdownShards

        public void shutdownShards​(ActorRef shuttingDownRegion,
                                   scala.collection.immutable.Set<java.lang.String> shards)