mirror of
https://github.com/usatiuk/dhfs.git
synced 2025-10-28 12:37:48 +01:00
Utils: slightly faster add in HashSetDelayedBlockingQueue
This commit is contained in:
@@ -34,11 +34,9 @@ public class HashSetDelayedBlockingQueue<T> {
|
||||
synchronized (this) {
|
||||
if (_closed) throw new IllegalStateException("Adding to a queue that is closed!");
|
||||
|
||||
if (_set.containsKey(el))
|
||||
if (_set.putIfAbsent(el, new SetElement<>(el, System.currentTimeMillis())) != null)
|
||||
return false;
|
||||
|
||||
_set.put(el, new SetElement<>(el, System.currentTimeMillis()));
|
||||
|
||||
this.notify();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user