use of io.helidon.common.context.ExecutorException in project helidon by oracle.
the class JulMdcTest method testThreadPropagation.
@Test
public void testThreadPropagation() {
HelidonMdc.set(TEST_KEY, TEST_VALUE);
Context context = Context.create();
ExecutorService executor = Contexts.wrap(Executors.newFixedThreadPool(1));
Contexts.runInContext(context, () -> {
try {
String value = executor.submit(new TestCallable()).get();
assertThat(value, is(TEST_VALUE));
} catch (Exception e) {
throw new ExecutorException("failed to execute", e);
}
});
}
use of io.helidon.common.context.ExecutorException in project helidon by oracle.
the class Log4jMdcTest method testThreadPropagation.
@Test
public void testThreadPropagation() {
HelidonMdc.set(TEST_KEY, TEST_VALUE);
Context context = Context.create();
ExecutorService executor = Contexts.wrap(Executors.newFixedThreadPool(1));
Contexts.runInContext(context, () -> {
try {
String value = executor.submit(new TestCallable()).get();
assertThat(value, is(TEST_VALUE));
} catch (Exception e) {
throw new ExecutorException("failed to execute", e);
}
});
}
use of io.helidon.common.context.ExecutorException in project helidon by oracle.
the class Slf4jMdcTest method testThreadPropagationWithEmptyMdc.
@Test
public void testThreadPropagationWithEmptyMdc() {
Context context = Context.create();
ExecutorService executor = Contexts.wrap(Executors.newFixedThreadPool(1));
Contexts.runInContext(context, () -> {
try {
Boolean value = executor.submit(new TestEmptyMdc()).get();
assertThat(value, is(true));
} catch (Exception e) {
throw new ExecutorException("failed to execute", e);
}
});
}
use of io.helidon.common.context.ExecutorException in project helidon by oracle.
the class Slf4jMdcTest method testThreadPropagation.
@Test
public void testThreadPropagation() {
HelidonMdc.set(TEST_KEY, TEST_VALUE);
Context context = Context.create();
ExecutorService executor = Contexts.wrap(Executors.newFixedThreadPool(1));
Contexts.runInContext(context, () -> {
try {
String value = executor.submit(new TestCallable()).get();
assertThat(value, is(TEST_VALUE));
} catch (Exception e) {
throw new ExecutorException("failed to execute", e);
}
});
}
Aggregations