use of com.cinchapi.concourse.server.concurrent.Token in project concourse by cinchapi.
the class AtomicOperation method contains.
@Override
public final boolean contains(long record) {
checkState();
Token token = Token.wrap(record);
source.addVersionChangeListener(token, this);
reads2Lock.add(token);
wideReads.put(record, token);
return super.contains(record);
}
use of com.cinchapi.concourse.server.concurrent.Token in project concourse by cinchapi.
the class AtomicOperation method select.
@Override
public final Map<String, Set<TObject>> select(long record) throws AtomicStateException {
checkState();
Token token = Token.wrap(record);
source.addVersionChangeListener(token, this);
reads2Lock.add(token);
wideReads.put(record, token);
return super.select(record);
}
use of com.cinchapi.concourse.server.concurrent.Token in project concourse by cinchapi.
the class AtomicOperation method select.
@Override
public final Set<TObject> select(String key, long record) throws AtomicStateException {
checkState();
Token token = Token.wrap(key, record);
source.addVersionChangeListener(token, this);
reads2Lock.add(token);
return super.select(key, record);
}
use of com.cinchapi.concourse.server.concurrent.Token in project concourse by cinchapi.
the class AtomicOperation method add.
@Override
protected final boolean add(Write write, Sync sync, Verify verify) throws AtomicStateException {
checkState();
String key = write.getKey().toString();
long record = write.getRecord().longValue();
Token token = Token.wrap(key, record);
RangeToken rangeToken = RangeToken.forWriting(write.getKey(), write.getValue());
Token wide = wideReads.get(record);
if (wide != null) {
wide.upgrade();
writes2Lock.add(wide);
} else {
source.addVersionChangeListener(token, this);
writes2Lock.add(token);
// CON-669: Prevent a
writes2Lock.add(Token.shareable(record));
// conflicting wide read,
// but don't listen for
// wide version change
}
writes2Lock.add(rangeToken);
return super.add(write, sync, verify);
}
use of com.cinchapi.concourse.server.concurrent.Token in project concourse by cinchapi.
the class AtomicOperation method review.
@Override
public final Map<Long, List<String>> review(long record) throws AtomicStateException {
checkState();
Token token = Token.wrap(record);
source.addVersionChangeListener(token, this);
reads2Lock.add(token);
wideReads.put(record, token);
return super.review(record);
}
Aggregations