org.multiverse.stms.gamma

## Class GlobalConflictCounter

- java.lang.Object
- - org.multiverse.stms.gamma.GlobalConflictCounter

    public final class GlobalConflictCounter
    extends java.lang.Object

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.

### Constructor Summary

Constructors
Constructor and Description
`GlobalConflictCounter()`

### Method Summary

Methods
`long` `count()` Gets the current conflict count.
`void` `signalConflict()` Signals that a conflict occurred.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### GlobalConflictCounter

    public GlobalConflictCounter()

### Method Detail

#### 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.