Skip to content

Commit

Permalink
Fix sync, fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jasontedor committed Aug 13, 2018
1 parent 8ac2ed5 commit 22d13a8
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public interface GlobalCheckpointListener {
// guarded by this
private boolean closed;
private volatile List<GlobalCheckpointListener> listeners;
private volatile long lastKnownGlobalCheckpoint = UNASSIGNED_SEQ_NO;
private long lastKnownGlobalCheckpoint = UNASSIGNED_SEQ_NO;

private final ShardId shardId;
private final Executor executor;
Expand All @@ -82,7 +82,7 @@ public interface GlobalCheckpointListener {

/**
* Add a global checkpoint listener. If the global checkpoint is above the current global checkpoint known to the listener then the
* listener will fire immediately on the calling thread.
* listener will be asynchronously fired on the executor used to construct this collection of global checkpoint listeners.
*
* @param currentGlobalCheckpoint the current global checkpoint known to the listener
* @param listener the listener
Expand Down Expand Up @@ -117,7 +117,9 @@ public void close() throws IOException {
*/
void globalCheckpointUpdated(final long globalCheckpoint) {
assert globalCheckpoint >= NO_OPS_PERFORMED;
lastKnownGlobalCheckpoint = globalCheckpoint;
synchronized (this) {
lastKnownGlobalCheckpoint = globalCheckpoint;
}
notifyListeners(globalCheckpoint, null);
}

Expand Down

0 comments on commit 22d13a8

Please sign in to comment.