Package akka.cluster.sharding
Class Shard
- java.lang.Object
-
- akka.cluster.sharding.Shard
-
- All Implemented Interfaces:
Actor
,ActorLogging
,Timers
- Direct Known Subclasses:
DDataShard
,PersistentShard
public class Shard extends java.lang.Object implements Actor, ActorLogging, Timers
Will call onLeaseAcquired when completed, also when lease isn't used
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Shard.CurrentShardState
static class
Shard.CurrentShardState$
static class
Shard.EntityStarted
static class
Shard.EntityStarted$
static class
Shard.EntityStopped
static class
Shard.EntityStopped$
static class
Shard.GetCurrentShardState$
static class
Shard.GetShardStats$
static class
Shard.LeaseAcquireResult
static class
Shard.LeaseAcquireResult$
static class
Shard.LeaseLost
static class
Shard.LeaseLost$
static class
Shard.LeaseRetry$
static class
Shard.PassivateIdleTick$
static class
Shard.RestartEntities
static class
Shard.RestartEntities$
static class
Shard.RestartEntity
static class
Shard.RestartEntity$
static interface
Shard.ShardCommand
static interface
Shard.ShardQuery
static class
Shard.ShardStats
static class
Shard.ShardStats$
static class
Shard.State
static class
Shard.State$
static interface
Shard.StateChange
-
Nested classes/interfaces inherited from interface akka.actor.Actor
Actor.emptyBehavior$, Actor.ignoringBehavior$
-
-
Constructor Summary
Constructors Constructor Description Shard(java.lang.String typeName, java.lang.String shardId, scala.Function1<java.lang.String,Props> entityProps, ClusterShardingSettings settings, 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)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acquireLeaseIfNeeded()
Will call onLeaseAcquired when completed, also when lease isn't usedprotected void
akka$actor$Actor$_setter_$context_$eq(ActorContext x$1)
protected void
akka$actor$Actor$_setter_$self_$eq(ActorRef x$1)
The 'self' field holds the ActorRef for this actor.void
appendToMessageBuffer(java.lang.String id, java.lang.Object msg, ActorRef snd)
ActorContext
context()
Scala API: Stores the context for this actor, including self, and sender.void
deliverMessage(java.lang.Object msg, ActorRef snd)
void
deliverTo(java.lang.String id, java.lang.Object msg, java.lang.Object payload, ActorRef snd)
void
entityTerminated(ActorRef ref)
ActorRef
getOrCreateEntity(java.lang.String id, scala.Function1<ActorRef,scala.runtime.BoxedUnit> onCreate)
scala.Function1<ActorRef,scala.runtime.BoxedUnit>
getOrCreateEntity$default$2()
scala.collection.immutable.Map<ActorRef,java.lang.String>
idByRef()
void
idByRef_$eq(scala.collection.immutable.Map<ActorRef,java.lang.String> x$1)
scala.collection.immutable.Map<java.lang.String,java.lang.Object>
lastMessageTimestamp()
void
lastMessageTimestamp_$eq(scala.collection.immutable.Map<java.lang.String,java.lang.Object> x$1)
MessageBufferMap<java.lang.String>
messageBuffers()
void
onLeaseAcquired()
void
passivateCompleted(Shard.EntityStopped event)
scala.Option<Cancellable>
passivateIdleTask()
scala.collection.immutable.Set<ActorRef>
passivating()
void
passivating_$eq(scala.collection.immutable.Set<ActorRef> x$1)
void
postStop()
User overridable callback.void
preStart()
User overridable callback.<E extends Shard.StateChange>
voidprocessChange(E event, scala.Function1<E,scala.runtime.BoxedUnit> handler)
static Props
props(java.lang.String typeName, java.lang.String shardId, scala.Function1<java.lang.String,Props> entityProps, ClusterShardingSettings settings, 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)
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit>
receive()
Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit>
receiveCommand()
void
receiveLeaseLost(Shard.LeaseLost msg)
void
receiveShardQuery(Shard.ShardQuery msg)
scala.collection.immutable.Map<java.lang.String,ActorRef>
refById()
void
refById_$eq(scala.collection.immutable.Map<java.lang.String,ActorRef> x$1)
ActorRef
self()
The 'self' field holds the ActorRef for this actor.void
sendMsgBuffer(Shard.EntityStarted event)
Shard.State
state()
void
state_$eq(Shard.State x$1)
void
touchLastMessageTimestamp(java.lang.String id)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.actor.Actor
aroundPostRestart, aroundPreStart, postRestart, preRestart, sender, supervisorStrategy, unhandled
-
Methods inherited from interface akka.actor.ActorLogging
_log_$eq, log
-
Methods inherited from interface akka.actor.Timers
actorCell, aroundPostStop, aroundPreRestart, aroundReceive, super$aroundPostStop, super$aroundPreRestart, super$aroundReceive, timers
-
-
-
-
Constructor Detail
-
Shard
public Shard(java.lang.String typeName, java.lang.String shardId, scala.Function1<java.lang.String,Props> entityProps, ClusterShardingSettings settings, 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)
-
-
Method Detail
-
props
public static Props props(java.lang.String typeName, java.lang.String shardId, scala.Function1<java.lang.String,Props> entityProps, ClusterShardingSettings settings, 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)
-
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 asforward
.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 aAbstractActor.ActorContext
, which is the Java API of the actor context.
-
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
-
akka$actor$Actor$_setter_$context_$eq
protected void akka$actor$Actor$_setter_$context_$eq(ActorContext x$1)
- Specified by:
akka$actor$Actor$_setter_$context_$eq
in interfaceActor
-
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 interfaceActor
- Parameters:
x$1
- (undocumented)
-
state
public Shard.State state()
-
state_$eq
public void state_$eq(Shard.State x$1)
-
idByRef
public scala.collection.immutable.Map<ActorRef,java.lang.String> idByRef()
-
idByRef_$eq
public void idByRef_$eq(scala.collection.immutable.Map<ActorRef,java.lang.String> x$1)
-
refById
public scala.collection.immutable.Map<java.lang.String,ActorRef> refById()
-
refById_$eq
public void refById_$eq(scala.collection.immutable.Map<java.lang.String,ActorRef> x$1)
-
lastMessageTimestamp
public scala.collection.immutable.Map<java.lang.String,java.lang.Object> lastMessageTimestamp()
-
lastMessageTimestamp_$eq
public void lastMessageTimestamp_$eq(scala.collection.immutable.Map<java.lang.String,java.lang.Object> x$1)
-
passivating
public scala.collection.immutable.Set<ActorRef> passivating()
-
passivating_$eq
public void passivating_$eq(scala.collection.immutable.Set<ActorRef> x$1)
-
messageBuffers
public MessageBufferMap<java.lang.String> messageBuffers()
-
passivateIdleTask
public scala.Option<Cancellable> passivateIdleTask()
-
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.
-
acquireLeaseIfNeeded
public void acquireLeaseIfNeeded()
Will call onLeaseAcquired when completed, also when lease isn't used
-
onLeaseAcquired
public void onLeaseAcquired()
-
processChange
public <E extends Shard.StateChange> void processChange(E event, scala.Function1<E,scala.runtime.BoxedUnit> handler)
-
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.
-
receiveCommand
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receiveCommand()
-
receiveLeaseLost
public void receiveLeaseLost(Shard.LeaseLost msg)
-
receiveShardQuery
public void receiveShardQuery(Shard.ShardQuery msg)
-
entityTerminated
public void entityTerminated(ActorRef ref)
-
touchLastMessageTimestamp
public void touchLastMessageTimestamp(java.lang.String id)
-
passivateCompleted
public void passivateCompleted(Shard.EntityStopped event)
-
sendMsgBuffer
public void sendMsgBuffer(Shard.EntityStarted event)
-
deliverMessage
public void deliverMessage(java.lang.Object msg, ActorRef snd)
-
appendToMessageBuffer
public void appendToMessageBuffer(java.lang.String id, java.lang.Object msg, ActorRef snd)
-
deliverTo
public void deliverTo(java.lang.String id, java.lang.Object msg, java.lang.Object payload, ActorRef snd)
-
getOrCreateEntity
public ActorRef getOrCreateEntity(java.lang.String id, scala.Function1<ActorRef,scala.runtime.BoxedUnit> onCreate)
-
getOrCreateEntity$default$2
public scala.Function1<ActorRef,scala.runtime.BoxedUnit> getOrCreateEntity$default$2()
-
-