void () { if (unparkPotentialWriters()) return; // Wake up all blocked readers List<Reader> dead; long current = System.nanoTime(); if (current - deadReadersGCStamp > 1_000_000) { dead = new ArrayList<>(participants.size()); deadReadersGCStamp = current; } else { dead = null; } for (Reader reader : participants) { if (reader.state == Reader.State.READ_REQ) { LockSupport.unpark(reader.thread); // parked by waitABit() break; } else if (dead != null && !reader.thread.isAlive()) { dead.add(reader); } } if (dead != null) { participants.removeAll(dead); } }