If we fail to create the `FileChannelReference` (e.g. because the directory it should be created in was deleted in a test) we have to remove the listener from the `listeners` set to not trip internal consistency assertions. Relates #65302 (does not fix it though, but reduces noise from failures by removing secondary tripped assertions after the test fails)
This commit is contained in:
parent
67b6317488
commit
b0cea04f95
|
@ -138,12 +138,12 @@ public class CacheFile {
|
|||
try {
|
||||
synchronized (listeners) {
|
||||
ensureOpen();
|
||||
final boolean added = listeners.add(listener);
|
||||
assert added : "listener already exists " + listener;
|
||||
if (listeners.size() == 1) {
|
||||
if (listeners.isEmpty()) {
|
||||
assert channelRef == null;
|
||||
channelRef = new FileChannelReference();
|
||||
}
|
||||
final boolean added = listeners.add(listener);
|
||||
assert added : "listener already exists " + listener;
|
||||
}
|
||||
success = true;
|
||||
} finally {
|
||||
|
|
Loading…
Reference in New Issue