Class AbstractActorWithLock
- java.lang.Object
-
- akka.actor.AbstractActor
-
- akka.actor.AbstractActorWithStash
-
- org.eclipse.ditto.services.utils.akka.AbstractActorWithLock
-
- All Implemented Interfaces:
akka.actor.Actor,akka.actor.Stash,akka.actor.StashSupport,akka.actor.UnrestrictedStash,akka.dispatch.RequiresMessageQueue<akka.dispatch.DequeBasedMessageQueueSemantics>
public abstract class AbstractActorWithLock extends akka.actor.AbstractActorWithStashActor that can prevent itself from handling messages for a period of time.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractActorWithLock()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidbecome(akka.actor.AbstractActor.Receive receive)Switches the actor's message handler.protected voidbecome(akka.actor.AbstractActor.Receive receive, boolean discardOld)Switches the actor's message handler.akka.actor.AbstractActor.ReceivecreateReceive()protected abstract akka.actor.AbstractActor.ReceivehandleMessage()voidpostStop()protected voidsetLocked(Duration maxLockTime)Prevents this actor from handling messages until it gets unlocked.protected voidunlock()Unlocks this actor to handle messages again.-
Methods inherited from class akka.actor.AbstractActorWithStash
akka$actor$StashSupport$_setter_$akka$actor$StashSupport$$capacity_$eq, akka$actor$StashSupport$_setter_$mailbox_$eq, akka$actor$StashSupport$$capacity, akka$actor$StashSupport$$theStash, akka$actor$StashSupport$$theStash_$eq, clearStash, mailbox, prepend, preRestart, stash, unstash, unstashAll, unstashAll
-
Methods inherited from class akka.actor.AbstractActor
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, context, emptyBehavior, getContext, getSelf, getSender, postRestart, preRestart, preStart, receive, receiveBuilder, self, sender, supervisorStrategy, unhandled
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
handleMessage
protected abstract akka.actor.AbstractActor.Receive handleMessage()
- Returns:
- Actor's usual message handler. It will always be invoked in the actor's thread.
-
setLocked
protected void setLocked(Duration maxLockTime)
Prevents this actor from handling messages until it gets unlocked.This method is NOT thread-safe and MUST be called in the actor's thread!
- Parameters:
maxLockTime- the maximum time the actor stays locked.- Throws:
NullPointerException- ifmaxLockTimeisnull.
-
unlock
protected void unlock()
Unlocks this actor to handle messages again.This method is thread-safe and can be called anywhere.
-
become
protected void become(akka.actor.AbstractActor.Receive receive)
Switches the actor's message handler.DO NOT call
getContext().become()directly; otherwise the actor loses the ability to lock itself.- Parameters:
receive- the new message handler.
-
become
protected void become(akka.actor.AbstractActor.Receive receive, boolean discardOld)Switches the actor's message handler.DO NOT call
getContext().become()directly; otherwise the actor loses the ability to lock itself.- Parameters:
receive- the new message handler.discardOld- whether the old handler should be discarded.
-
createReceive
public final akka.actor.AbstractActor.Receive createReceive()
- Specified by:
createReceivein classakka.actor.AbstractActor
-
-