DBZ-8135 Added comment about locking to InProcessSignalChannel

This commit is contained in:
Jakub Cechacek 2024-08-20 10:14:31 +02:00 committed by Jiri Pechanec
parent fe5196ac47
commit f27e15bc5f

View File

@ -55,6 +55,16 @@ public List<SignalRecord> read() {
return Stream.ofNullable(signals.poll()).toList();
}
/**
* Close the channel and drain all the signals
*
* <p>
* Note: To properly synchronise closing and reading a lock should be used.
* However this is not necessary as any concurrent call to these methods is
* equal to serially calling read and close (or the other way around). The
* connector handles both cases (and the queue is already thread safe).
* </p>
*/
@Override
public void close() {
if (open.compareAndSet(true, false)) {