trait Member extends AnyRef
A participant in a synchronized group commit. Each member of a commit
barrier must arrange for either atomic
or cancel
to be called,
otherwise the other members won't be able to commit.
- Alphabetic
- By Inheritance
- Member
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
atomic[Z](body: (InTxn) ⇒ Z): Either[CancelCause, Z]
Atomically executes
body
as part of a commit barrier, ensuring that if the transaction commits, all actions performed by all members of the commit barrier appear to occur simultaneously.Atomically executes
body
as part of a commit barrier, ensuring that if the transaction commits, all actions performed by all members of the commit barrier appear to occur simultaneously. If the transaction commits then the valuev
returned bybody
is returned asRight(v)
. If this member is cancelled then this method returnsLeft(c)
, wherec
describes the first cause passed to thecancel
method. If this member is not cancelled but the transaction is rolled back without the possibility of retry, then this method throws an exception the same as any other atomic block (seeTxnExecutor.apply
).It is not allowed to chain
orAtomic
onto this form ofatomic
, but you can accomplish the same effect with a nested atomic block:member.atomic { implicit txn => atomic { implicit txn => ... first alternative } orAtomic { implicit txn => ... second alternative } }
In the current version of ScalaSTM this method may only be used if there is no enclosing transaction; an STM implementation may throw
IllegalStateException
if there is already an active transaction on this thread. This restriction might be relaxed in the future if there is a use case for it (and a semantics for how it should work).- body
the code to run atomically
- returns
Right(v)
wherev
is the result of successfully runningbody
in an atomic block, orLeft(c)
wherec
is the reason for this member's cancellation
- Exceptions thrown
IllegalStateException
if called from inside the dynamic scope of an existing transaction and that is not supported by the chosen STM implementation
-
abstract
def
cancel(cause: UserCancel): Unit
Removes this member from the commit barrier, and causes any pending or future calls to
this.atomic
to return aLeft
.Removes this member from the commit barrier, and causes any pending or future calls to
this.atomic
to return aLeft
. If the commit barrier has already committed successfully this method throwsIllegalStateException
. It is safe to call this method multiple times.- cause
the cancel cause to return from
atomic
- Exceptions thrown
IllegalStateException
if the commit barrier has already decided to commit
-
abstract
def
commitBarrier: CommitBarrier
Returns the commit barrier of which this instance is a member.
-
abstract
def
executor: TxnExecutor
Returns the
TxnExecutor
that will be used byatomic
.Returns the
TxnExecutor
that will be used byatomic
. This is initialized during construction to the defaultTxnExecutor
(returned byscala.concurrent.stm.atomic
). -
abstract
def
executor_=(v: TxnExecutor): Unit
Changes the
TxnExecutor
that will be used byatomic
.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
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
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )