Package org.multiverse.stms.gamma
Class GlobalConflictCounter
java.lang.Object
org.multiverse.stms.gamma.GlobalConflictCounter
The GlobalConflictCounter is used as a mechanism for guaranteeing read consistency. Depending on the configuration of the
transaction, if a transaction does a read, it also makes the read semi visible (only the number of readers are interesting
and not the actual transaction). If a updating transaction sees that there are readers, it increased the GlobalConflictCounter
and forces all reading transactions to do a conflict scan once they read transactional objects they have not read before.
This mechanism is based on the SkySTM. The advantage of this approach compared to the TL2 approach is that the GlobalConflictCounter
is only increased on conflict and not on every update.
Small transactions don't make use of this mechanism and do a full conflict scan every time. The advantage is that the pressure
on the GlobalConflictCounter is reduced and that expensive arrives/departs (requiring in most cases 1 or 2 cas operations)
are reduced as well.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
count()
Gets the current conflict count.void
Signals that a conflict occurred.
-
Field Details
-
counter
-
-
Constructor Details
-
GlobalConflictCounter
public GlobalConflictCounter()
-
-
Method Details
-
signalConflict
public void signalConflict()Signals that a conflict occurred. -
count
public long count()Gets the current conflict count. The actual value is not interesting, only the change is important.- Returns:
- the current conflict count.
-