[#1885] Correctly close leak detected also on non started HashedWheelTimer

This commit is contained in:
Norman Maurer 2013-10-02 06:44:55 +02:00
parent ee192f0321
commit 3739ee90cf

View File

@ -273,6 +273,11 @@ public class HashedWheelTimer implements Timer {
if (!workerState.compareAndSet(WORKER_STATE_STARTED, WORKER_STATE_SHUTDOWN)) { if (!workerState.compareAndSet(WORKER_STATE_STARTED, WORKER_STATE_SHUTDOWN)) {
// workerState can be 0 or 2 at this moment - let it always be 2. // workerState can be 0 or 2 at this moment - let it always be 2.
workerState.set(WORKER_STATE_SHUTDOWN); workerState.set(WORKER_STATE_SHUTDOWN);
if (leak != null) {
leak.close();
}
return Collections.emptySet(); return Collections.emptySet();
} }