Skip to content

Commit dee0ad2

Browse files
committed
Address PR review
1 parent 52a118e commit dee0ad2

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

vertx-core/src/main/java/io/vertx/core/impl/VertxImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ public class VertxImpl implements VertxInternal, MetricsProvider {
124124
private static final String NETTY_IO_RATIO_PROPERTY_NAME = "vertx.nettyIORatio";
125125
private static final int NETTY_IO_RATIO = Integer.getInteger(NETTY_IO_RATIO_PROPERTY_NAME, 50);
126126

127+
private static boolean disposedCAS(InternalTimerHandler handler) {
128+
return INTERNAL_TIMER_HANDLER_DISPOSED.compareAndSet(handler, false, true);
129+
}
130+
127131
// Not cached for graalvm
128132
private static ThreadFactory virtualThreadFactory() {
129133
try {
@@ -1098,7 +1102,7 @@ public void handle(Void v) {
10981102
if (!disposed) {
10991103
handler.handle(id);
11001104
}
1101-
} else if (compareAndSetDisposed()) {
1105+
} else if (disposedCAS(this)) {
11021106
timeouts.remove(id);
11031107
try {
11041108
handler.handle(id);
@@ -1120,7 +1124,7 @@ private boolean cancel() {
11201124
}
11211125

11221126
private boolean tryCancel() {
1123-
if (compareAndSetDisposed()) {
1127+
if (disposedCAS(this)) {
11241128
timeouts.remove(id);
11251129
future.cancel(false);
11261130
return true;
@@ -1134,10 +1138,6 @@ public void close(Completable<Void> completion) {
11341138
tryCancel();
11351139
completion.succeed();
11361140
}
1137-
1138-
private boolean compareAndSetDisposed() {
1139-
return INTERNAL_TIMER_HANDLER_DISPOSED.compareAndSet(this, false, true);
1140-
}
11411141
}
11421142

11431143
@Override

0 commit comments

Comments
 (0)