Class ShardRegion

  • All Implemented Interfaces:
    Actor, Timers

    public class ShardRegion
    extends java.lang.Object
    implements Actor, Timers
    When leaving the coordinator singleton is started rather quickly on next oldest node and therefore it is good to send the GracefulShutdownReq to the likely locations of the coordinator.
    • Constructor Detail

      • ShardRegion

        public ShardRegion​(java.lang.String typeName,
                           scala.Option<scala.Function1<java.lang.String,​Props>> entityProps,
                           scala.Option<java.lang.String> dataCenter,
                           ClusterShardingSettings settings,
                           java.lang.String coordinatorPath,
                           scala.PartialFunction<java.lang.Object,​scala.Tuple2<java.lang.String,​java.lang.Object>> extractEntityId,
                           scala.Function1<java.lang.Object,​java.lang.String> extractShardId,
                           java.lang.Object handOffStopMessage,
                           ActorRef replicator,
                           int majorityMinCap)
    • Method Detail

      • props

        public static Props props​(java.lang.String typeName,
                                  scala.Function1<java.lang.String,​Props> entityProps,
                                  ClusterShardingSettings settings,
                                  java.lang.String coordinatorPath,
                                  scala.PartialFunction<java.lang.Object,​scala.Tuple2<java.lang.String,​java.lang.Object>> extractEntityId,
                                  scala.Function1<java.lang.Object,​java.lang.String> extractShardId,
                                  java.lang.Object handOffStopMessage,
                                  ActorRef replicator,
                                  int majorityMinCap)
      • proxyProps

        public static Props proxyProps​(java.lang.String typeName,
                                       scala.Option<java.lang.String> dataCenter,
                                       ClusterShardingSettings settings,
                                       java.lang.String coordinatorPath,
                                       scala.PartialFunction<java.lang.Object,​scala.Tuple2<java.lang.String,​java.lang.Object>> extractEntityId,
                                       scala.Function1<java.lang.Object,​java.lang.String> extractShardId,
                                       ActorRef replicator,
                                       int majorityMinCap)
        INTERNAL API Factory method for the Props of the ShardRegion actor when using it in proxy only mode.
        Parameters:
        typeName - (undocumented)
        dataCenter - (undocumented)
        settings - (undocumented)
        coordinatorPath - (undocumented)
        extractEntityId - (undocumented)
        extractShardId - (undocumented)
        replicator - (undocumented)
        majorityMinCap - (undocumented)
        Returns:
        (undocumented)
      • handOffStopperProps

        public static Props handOffStopperProps​(java.lang.String shard,
                                                ActorRef replyTo,
                                                scala.collection.immutable.Set<ActorRef> entities,
                                                java.lang.Object stopMessage,
                                                scala.concurrent.duration.FiniteDuration handoffTimeout)
      • 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
        Returns:
        (undocumented)
      • 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
        Returns:
        (undocumented)
      • 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
        Parameters:
        x$1 - (undocumented)
      • cluster

        public Cluster cluster()
      • ageOrdering

        public scala.math.Ordering<Member> ageOrdering()
      • membersByAge

        public scala.collection.immutable.SortedSet<Member> membersByAge()
      • membersByAge_$eq

        public void membersByAge_$eq​(scala.collection.immutable.SortedSet<Member> x$1)
      • regions

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

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

        public scala.collection.immutable.Map<java.lang.String,​ActorRef> regionByShard()
      • regionByShard_$eq

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

        public void shardBuffers_$eq​(MessageBufferMap<java.lang.String> x$1)
      • loggedFullBufferWarning

        public boolean loggedFullBufferWarning()
      • loggedFullBufferWarning_$eq

        public void loggedFullBufferWarning_$eq​(boolean x$1)
      • shards

        public scala.collection.immutable.Map<java.lang.String,​ActorRef> shards()
      • shards_$eq

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

        public scala.collection.immutable.Map<ActorRef,​java.lang.String> shardsByRef()
      • shardsByRef_$eq

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

        public scala.collection.immutable.Set<java.lang.String> startingShards()
      • startingShards_$eq

        public void startingShards_$eq​(scala.collection.immutable.Set<java.lang.String> x$1)
      • handingOff

        public scala.collection.immutable.Set<ActorRef> handingOff()
      • handingOff_$eq

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

        public boolean gracefulShutdownInProgress()
      • gracefulShutdownInProgress_$eq

        public void gracefulShutdownInProgress_$eq​(boolean x$1)
      • retryCount

        public int retryCount()
      • retryCount_$eq

        public void retryCount_$eq​(int x$1)
      • initRegistrationDelay

        public scala.concurrent.duration.FiniteDuration initRegistrationDelay()
      • nextRegistrationDelay

        public scala.concurrent.duration.FiniteDuration nextRegistrationDelay()
      • nextRegistrationDelay_$eq

        public void nextRegistrationDelay_$eq​(scala.concurrent.duration.FiniteDuration x$1)
      • gracefulShutdownProgress

        public scala.concurrent.Promise<Done> gracefulShutdownProgress()
      • 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
      • matchingRole

        public boolean matchingRole​(Member member)
      • coordinatorSelection

        public scala.Option<ActorSelection> coordinatorSelection()
      • gracefulShutdownCoordinatorSelections

        public scala.collection.immutable.List<ActorSelection> gracefulShutdownCoordinatorSelections()
        When leaving the coordinator singleton is started rather quickly on next oldest node and therefore it is good to send the GracefulShutdownReq to the likely locations of the coordinator.
        Returns:
        (undocumented)
      • coordinator

        public scala.Option<ActorRef> coordinator()
      • coordinator_$eq

        public void coordinator_$eq​(scala.Option<ActorRef> x$1)
      • changeMembers

        public void changeMembers​(scala.collection.immutable.SortedSet<Member> newMembers)
      • receive

        public scala.PartialFunction<java.lang.Object,​scala.runtime.BoxedUnit> receive()
        Description copied from interface: Actor
        Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.
        Specified by:
        receive in interface Actor
        Returns:
        (undocumented)
      • receiveCoordinatorMessage

        public void receiveCoordinatorMessage​(akka.cluster.sharding.ShardCoordinator.Internal.CoordinatorMessage msg)
      • receiveTerminated

        public void receiveTerminated​(ActorRef ref)
      • replyToRegionStateQuery

        public void replyToRegionStateQuery​(ActorRef ref)
      • replyToRegionStatsQuery

        public void replyToRegionStatsQuery​(ActorRef ref)
      • queryShards

        public <T> scala.concurrent.Future<ShardingQueries.ShardsQueryResult<T>> queryShards​(scala.collection.immutable.Map<java.lang.String,​ActorRef> shards,
                                                                                             java.lang.Object msg,
                                                                                             scala.reflect.ClassTag<T> evidence$1)
        Query all or a subset of shards, e.g. unresponsive shards that initially timed out. If the number of shards are less than this.shards.size, this could be a retry. Returns a partitioned set of any shards that may have not replied within the timeout and shards that did reply, to provide retry on only that subset.

        Logs a warning if any of the group timed out.

        To check subset unresponsive:

         queryShards[T](shards.filterKeys(u.contains), shardQuery) 
        Parameters:
        shards - (undocumented)
        msg - (undocumented)
        evidence$1 - (undocumented)
        Returns:
        (undocumented)
      • startRegistration

        public void startRegistration()
      • scheduleNextRegistration

        public void scheduleNextRegistration()
      • finishRegistration

        public void finishRegistration()
      • register

        public void register()
      • registrationMessage

        public java.lang.Object registrationMessage()
      • requestShardBufferHomes

        public void requestShardBufferHomes()
      • initializeShard

        public void initializeShard​(java.lang.String id,
                                    ActorRef shard)
      • bufferMessage

        public void bufferMessage​(java.lang.String shardId,
                                  java.lang.Object msg,
                                  ActorRef snd)
      • deliverBufferedMessages

        public void deliverBufferedMessages​(java.lang.String shardId,
                                            ActorRef receiver)
      • deliverMessage

        public void deliverMessage​(java.lang.Object msg,
                                   ActorRef snd)
      • getShard

        public scala.Option<ActorRef> getShard​(java.lang.String id)
      • sendGracefulShutdownToCoordinator

        public void sendGracefulShutdownToCoordinator()