use of java.util.concurrent.ThreadPoolExecutor.AbortPolicy in project reactor-core by reactor.
the class MonoPublishOnTest method rejectedExecutionSubscribeExecutorServiceScheduler.
@Test
@Ignore
public // FIXME the behavior is not failing fast anymore, find original issue and re-evaluate
void rejectedExecutionSubscribeExecutorServiceScheduler() {
CountDownLatch latch = new CountDownLatch(1);
ExecutorService executor = new ThreadPoolExecutor(1, 1, 0L, MILLISECONDS, new SynchronousQueue<>(), new AbortPolicy());
try {
executor.submit(() -> {
try {
latch.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
});
try {
Mono.just(1).publishOn(fromExecutor(executor)).block();
Assert.fail("Bubbling RejectedExecutionException expected");
} catch (Exception e) {
assertThat(Exceptions.unwrap(e), instanceOf(RejectedExecutionException.class));
}
} finally {
latch.countDown();
executor.shutdownNow();
}
}
use of java.util.concurrent.ThreadPoolExecutor.AbortPolicy in project reactor-core by reactor.
the class MonoPublishOnTest method rejectedExecutionSubscribeExecutorScheduler.
@Test
@Ignore
public // FIXME the behavior is not failing fast anymore, find original issue and re-evaluate
void rejectedExecutionSubscribeExecutorScheduler() {
CountDownLatch latch = new CountDownLatch(1);
ExecutorService executor = new ThreadPoolExecutor(1, 1, 0L, MILLISECONDS, new SynchronousQueue<>(), new AbortPolicy());
try {
executor.submit(() -> {
try {
latch.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
});
try {
Mono.just(1).publishOn(fromExecutor(executor)).block();
Assert.fail("Bubbling RejectedExecutionException expected");
} catch (Exception e) {
assertThat(Exceptions.unwrap(e), instanceOf(RejectedExecutionException.class));
}
} finally {
latch.countDown();
executor.shutdownNow();
}
executor.shutdownNow();
}
use of java.util.concurrent.ThreadPoolExecutor.AbortPolicy in project faf-java-server by FAForever.
the class LegacyAdapterConfig method createNioTaskExecutor.
@NotNull
private Executor createNioTaskExecutor(String threadNamePrefix) {
ThreadPoolTaskExecutor ioExecutor = new ThreadPoolTaskExecutor();
ioExecutor.setCorePoolSize(1);
ioExecutor.setMaxPoolSize(4);
ioExecutor.setQueueCapacity(0);
ioExecutor.setThreadNamePrefix(threadNamePrefix);
ioExecutor.setRejectedExecutionHandler(new AbortPolicy());
ioExecutor.initialize();
return ioExecutor;
}
use of java.util.concurrent.ThreadPoolExecutor.AbortPolicy in project spring-integration by spring-projects.
the class TcpNioConnectionTests method compositeExecutor.
private CompositeExecutor compositeExecutor() {
ThreadPoolTaskExecutor ioExec = new ThreadPoolTaskExecutor();
ioExec.setCorePoolSize(2);
ioExec.setMaxPoolSize(4);
ioExec.setQueueCapacity(0);
ioExec.setThreadNamePrefix("io-");
ioExec.setRejectedExecutionHandler(new AbortPolicy());
ioExec.initialize();
ThreadPoolTaskExecutor assemblerExec = new ThreadPoolTaskExecutor();
assemblerExec.setCorePoolSize(2);
assemblerExec.setMaxPoolSize(5);
assemblerExec.setQueueCapacity(0);
assemblerExec.setThreadNamePrefix("assembler-");
assemblerExec.setRejectedExecutionHandler(new AbortPolicy());
assemblerExec.initialize();
return new CompositeExecutor(ioExec, assemblerExec);
}
use of java.util.concurrent.ThreadPoolExecutor.AbortPolicy in project mule by mulesoft.
the class SimpleUnitTestSupportSchedulerService method customScheduler.
@Override
public Scheduler customScheduler(SchedulerConfig config) {
final SimpleUnitTestSupportScheduler customScheduler = new SimpleUnitTestSupportCustomScheduler(config.getMaxConcurrentTasks(), buildThreadFactory(config), new AbortPolicy());
customSchedulers.add(customScheduler);
final SimpleUnitTestSupportLifecycleSchedulerDecorator decorator = decorateScheduler(customScheduler);
decorators.add(decorator);
return decorator;
}
Aggregations