in commit-table/src/main/java/org/apache/omid/committable/InMemoryCommitTable.java [113:139]
public ListenableFuture<Boolean> tryInvalidateTransaction(long startTimestamp) {
startTimestamp = removeCheckpointBits(startTimestamp);
SettableFuture<Boolean> f = SettableFuture.create();
Long old = table.get(startTimestamp);
// If the transaction represented by startTimestamp is not in the map
if (old == null) {
// Try to invalidate the transaction
old = table.putIfAbsent(startTimestamp, INVALID_TRANSACTION_MARKER);
// If we were able to invalidate or someone else invalidate before us
if (old == null || old == INVALID_TRANSACTION_MARKER) {
f.set(true);
return f;
}
} else {
// Check if the value we read marked the transaction as invalid
if (old == INVALID_TRANSACTION_MARKER) {
f.set(true);
return f;
}
}
// At this point the transaction was already in the map at the beginning
// of the method or was added right before we tried to invalidate.
f.set(false);
return f;
}