abstract class StashBuffer[T] extends AnyRef
A non thread safe mutable message buffer that can be used to buffer messages inside actors and then unstash them.
The buffer can hold at most the given capacity
number of messages.
Not for user extension.
- Annotations
- @DoNotInherit()
- Source
- StashBuffer.scala
- Alphabetic
- By Inheritance
- StashBuffer
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new StashBuffer()
Abstract Value Members
-
abstract
def
forEach(f: Consumer[T]): Unit
Iterate over all elements of the buffer and apply a function to each element, without removing them.
Iterate over all elements of the buffer and apply a function to each element, without removing them.
- f
the function to apply to each element
-
abstract
def
head: T
Return the first element of the message buffer without removing it.
Return the first element of the message buffer without removing it.
- returns
the first element or throws
NoSuchElementException
if the buffer is empty
- Exceptions thrown
`NoSuchElementException`
if the buffer is empty
-
abstract
def
isEmpty: Boolean
Check if the message buffer is empty.
Check if the message buffer is empty.
- returns
if the buffer is empty
-
abstract
def
isFull: Boolean
- returns
true
if no more messages can be added, i.e. size equals the capacity of the stash buffer
-
abstract
def
nonEmpty: Boolean
Check if the message buffer is not empty.
Check if the message buffer is not empty.
- returns
if the buffer is not empty
-
abstract
def
size: Int
How many elements are in the message buffer.
How many elements are in the message buffer.
- returns
the number of elements in the message buffer
-
abstract
def
stash(message: T): StashBuffer[T]
Add one element to the end of the message buffer.
Add one element to the end of the message buffer.
StashOverflowException is thrown if the buffer StashBuffer#isFull.
- message
the message to buffer
- returns
this message buffer
- Exceptions thrown
`StashOverflowException`
is thrown if the buffer StashBuffer#isFull.
-
abstract
def
unstash(ctx: ActorContext[T], behavior: Behavior[T], numberOfMessages: Int, wrap: Function[T, T]): Behavior[T]
Process
numberOfMessages
of the stashed messages with thebehavior
and the returned Behavior from each processed message.Process
numberOfMessages
of the stashed messages with thebehavior
and the returned Behavior from each processed message.The purpose of this method, compared to
unstashAll
, is to unstash a limited number of messages and then send a message toself
before continuing unstashing more. That means that other new messages may arrive in-between and those must be stashed to keep the original order of messages. To differentiate between unstashed and new incoming messages the unstashed messages can be wrapped in another message with thewrap
.If an exception is thrown by processing a message a proceeding messages and the message causing the exception have been removed from the
StashBuffer
, but unprocessed messages remain.It's allowed to stash messages while unstashing. Those newly added messages will not be processed by this call and have to be unstashed in another call.
The
behavior
passed tounstash
must not beunhandled
. -
abstract
def
unstashAll(ctx: ActorContext[T], behavior: Behavior[T]): Behavior[T]
Process all stashed messages with the
behavior
and the returned Behavior from each processed message.Process all stashed messages with the
behavior
and the returned Behavior from each processed message. TheStashBuffer
will be empty after processing all messages, unless an exception is thrown or messages are stashed while unstashing.If an exception is thrown by processing a message a proceeding messages and the message causing the exception have been removed from the
StashBuffer
, but unprocessed messages remain.It's allowed to stash messages while unstashing. Those newly added messages will not be processed by this call and have to be unstashed in another call.
The
behavior
passed tounstashAll
must not beunhandled
.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from StashBuffer[T] to any2stringadd[StashBuffer[T]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (StashBuffer[T], B)
- Implicit
- This member is added by an implicit conversion from StashBuffer[T] to ArrowAssoc[StashBuffer[T]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate() @throws( ... )
-
def
ensuring(cond: (StashBuffer[T]) ⇒ Boolean, msg: ⇒ Any): StashBuffer[T]
- Implicit
- This member is added by an implicit conversion from StashBuffer[T] to Ensuring[StashBuffer[T]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (StashBuffer[T]) ⇒ Boolean): StashBuffer[T]
- Implicit
- This member is added by an implicit conversion from StashBuffer[T] to Ensuring[StashBuffer[T]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): StashBuffer[T]
- Implicit
- This member is added by an implicit conversion from StashBuffer[T] to Ensuring[StashBuffer[T]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): StashBuffer[T]
- Implicit
- This member is added by an implicit conversion from StashBuffer[T] to Ensuring[StashBuffer[T]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from StashBuffer[T] to StringFormat[StashBuffer[T]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
→[B](y: B): (StashBuffer[T], B)
- Implicit
- This member is added by an implicit conversion from StashBuffer[T] to ArrowAssoc[StashBuffer[T]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc