Skip to content

Commit

Permalink
Extract the Vert.x loop thread prefix as a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
jponge committed Nov 6, 2020
1 parent 3683cbf commit a2a2a74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;

import io.quarkus.mutiny.runtime.MutinyInfrastructure;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -91,7 +92,7 @@ public void testForbiddenUniBlocking() throws InterruptedException {
throwable.set(err);
}
latch.countDown();
}, "vert.x-eventloop-thread-0").start();
}, MutinyInfrastructure.VERTX_EVENT_LOOP_THREAD_PREFIX + "0").start();

Assertions.assertTrue(latch.await(5, TimeUnit.SECONDS));
Assertions.assertNull(item.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
@Recorder
public class MutinyInfrastructure {

public static final String VERTX_EVENT_LOOP_THREAD_PREFIX = "vert.x-eventloop-thread-";

public void configureMutinyInfrastructure(ExecutorService exec) {
Infrastructure.setDefaultExecutor(exec);
}
Expand All @@ -36,7 +38,7 @@ public boolean getAsBoolean() {
* calling from a Vert.x event-loop context / thread.
*/
String threadName = Thread.currentThread().getName();
return !threadName.startsWith("vert.x-eventloop-thread-");
return !threadName.startsWith(VERTX_EVENT_LOOP_THREAD_PREFIX);
}
});
}
Expand Down

0 comments on commit a2a2a74

Please sign in to comment.