CCSTM

class CCSTM extends CCSTMExecutor with STMImpl with Factory

The reference STM implementation for scala.concurrent.stm. CCSTM is a library-only STM based on the SwissTM algorithm, extended to reduce the overhead of non-transactional accesses, allow partial rollback, and include modular blocking and composition operators retry and orAtomic.

The reference STM implementation for scala.concurrent.stm. CCSTM is a library-only STM based on the SwissTM algorithm, extended to reduce the overhead of non-transactional accesses, allow partial rollback, and include modular blocking and composition operators retry and orAtomic.

During construction the system property "ccstm.stats" is checked. If it is "true" or "1" (actually if it starts with any of the characters 't', 'T', 'y', 'Y', or '1') then statistics are recorded while the program runs and printed to Console during JVM shutdown.

Statistics are tracked separately for top-level transactions and true nested transactions. Many nested atomic blocks can be merged into the top-level transaction by CCSTM for efficiency; these are not reported as nested.

Reported statistics are either counts or exponential histograms. For histograms sum is the sum of the samples, count is the number of transactions for which the statistic was non-zero, avg is sum/count and the histogram reports in brackets the number of samples that had a value of 1, 2..3, 4..7, 8..15, and so on.

Counters:

  • commits -- committed transactions
  • alternatives -- alternatives provided to atomic, one sample per call to atomic
  • retrySet -- memory locations watched while performing modular blocking, one sample per top-level blocking event
  • retryWaitElapsed -- milliseconds elapsed during modular blocking, one sample per top-level blocking event
  • explicitRetries -- explicit retries using retry, retryFor, Ref.View.await or Ref.View.tryAwait
  • unrecordedTxns -- rollbacks that were to erase a successful use of atomic.unrecorded
  • optimisticRetries -- rollbacks that were automatically retried, one line per OptimisticFailureCause.category
  • failures -- rollbacks that were not retried, one line for each type of exception in UncaughtExceptionCause
  • blockingAcquires -- internal locks that could not be acquired immediately
  • commitReadSet -- optimistic Ref reads, one sample per committed top-level transaction
  • commitBargeSet -- locations read pessimistically, one sample per committed top-level transaction
  • commitWriteSet -- locations written, one sample per committed top-level transaction
  • rollbackReadSet -- optimistic Ref reads, one sample per transaction that was rolled back
  • rollbackBargeSet -- locations read pessimistically, one sample per transaction that was rolled back
  • rollbackWriteSet -- locations written pessimistically, one sample per transaction that was rolled back

Read and write set counts for a nested transaction are merged into its parent if it commits, they are not counted separately during the nested commit.

Authors

Nathan Bronson

trait Factory
trait STMImpl
class CCSTMExecutor
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Value members

Concrete methods

def findCurrent(mt: MaybeTxn): Option[InTxn]
def newCommitBarrier(timeout: Long, unit: TimeUnit): CommitBarrier

Inherited methods

def apply[Z](block: InTxn => Z)(mt: MaybeTxn): Z
Inherited from
CCSTMExecutor
def compareAndSet[A, B](a: Ref[A], a0: A, a1: A, b: Ref[B], b0: B, b1: B): Boolean
Inherited from
CCSTMExecutor
def compareAndSetIdentity[A <: AnyRef, B <: AnyRef](a: Ref[A], a0: A, a1: A, b: Ref[B], b0: B, b1: B): Boolean
Inherited from
CCSTMExecutor
def isControlFlow(x: Throwable): Boolean
Inherited from
CCSTMExecutor
def newRef[T](v0: T)(`evidence$1`: ClassTag[T]): Ref[T]
Inherited from
Factory
def newRef(v0: Unit): Ref[Unit]
Inherited from
Factory
def newRef(v0: Double): Ref[Double]
Inherited from
Factory
def newRef(v0: Long): Ref[Long]
Inherited from
Factory
def newRef(v0: Float): Ref[Float]
Inherited from
Factory
def newRef(v0: Int): Ref[Int]
Inherited from
Factory
def newRef(v0: Char): Ref[Char]
Inherited from
Factory
def newRef(v0: Short): Ref[Short]
Inherited from
Factory
def newRef(v0: Byte): Ref[Byte]
Inherited from
Factory
def newRef(v0: Boolean): Ref[Boolean]
Inherited from
Factory
def newTArray[A](xs: IterableOnce[A])(`evidence$3`: ClassTag[A]): TArray[A]
Inherited from
Factory
def newTArray[A](length: Int)(`evidence$2`: ClassTag[A]): TArray[A]
Inherited from
Factory
def newTMap[A, B]: TMap[A, B]
Inherited from
Factory
def newTMapBuilder[A, B]: Builder[(A, B), TMap[A, B]]
Inherited from
Factory
def newTSet[A]: TSet[A]
Inherited from
Factory
def newTSetBuilder[A]: Builder[A, TSet[A]]
Inherited from
Factory
def newTxnLocal[A](init: => A, initialValue: InTxn => A, beforeCommit: InTxn => Unit, whilePreparing: InTxnEnd => Unit, whileCommitting: InTxnEnd => Unit, afterCommit: A => Unit, afterRollback: Status => Unit, afterCompletion: Status => Unit): TxnLocal[A]
Inherited from
Factory
def oneOf[Z](blocks: InTxn => Z*)(mt: MaybeTxn): Z
Inherited from
CCSTMExecutor
def productElementNames: Iterator[String]
Inherited from
Product
def productIterator: Iterator[Any]
Inherited from
Product
def pushAlternative[Z](mt: MaybeTxn, block: InTxn => Z): Boolean
Inherited from
CCSTMExecutor
override def toString: String
Definition Classes
CCSTMExecutor -> Any
Inherited from
CCSTMExecutor
def unrecorded[Z](block: InTxn => Z, outerFailure: RollbackCause => Z)(mt: MaybeTxn): Z
Inherited from
CCSTMExecutor
def withControlFlowRecognizer(pf: PartialFunction[Throwable, Boolean]): TxnExecutor
Inherited from
CCSTMExecutor
def withPostDecisionFailureHandler(handler: (Status, Throwable) => Unit): TxnExecutor
Inherited from
CCSTMExecutor
def withRetryTimeout(timeout: Long, unit: TimeUnit): TxnExecutor

Returns a TxnExecutor that is identical to this one except that it has the specified retry timeout. The default time unit is milliseconds. If the retry timeout expires the retry will be cancelled with an InterruptedException.

Returns a TxnExecutor that is identical to this one except that it has the specified retry timeout. The default time unit is milliseconds. If the retry timeout expires the retry will be cancelled with an InterruptedException.

Inherited from
TxnExecutor
def withRetryTimeoutNanos(timeout: Option[Long]): TxnExecutor
Inherited from
CCSTMExecutor