Search in sources :

Example 1 with PublisherThreadFactory

use of org.ff4j.audit.PublisherThreadFactory in project ff4j by ff4j.

the class ExceptionsTest method testExceptionHandler.

@Test
public void testExceptionHandler() {
    EventRejectedExecutionHandler ereh = new EventRejectedExecutionHandler();
    final BlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(2);
    // Executor with worker to process threads
    RejectedExecutionHandler rej = new EventRejectedExecutionHandler();
    ThreadFactory tFactorty = new PublisherThreadFactory();
    ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, queue, tFactorty, rej);
    ereh.rejectedExecution(new Thread(), executor);
}
Also used : PublisherThreadFactory(org.ff4j.audit.PublisherThreadFactory) ThreadFactory(java.util.concurrent.ThreadFactory) PublisherThreadFactory(org.ff4j.audit.PublisherThreadFactory) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) EventRejectedExecutionHandler(org.ff4j.audit.EventRejectedExecutionHandler) RejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) EventRejectedExecutionHandler(org.ff4j.audit.EventRejectedExecutionHandler) Test(org.junit.Test)

Aggregations

ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1 RejectedExecutionHandler (java.util.concurrent.RejectedExecutionHandler)1 ThreadFactory (java.util.concurrent.ThreadFactory)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 EventRejectedExecutionHandler (org.ff4j.audit.EventRejectedExecutionHandler)1 PublisherThreadFactory (org.ff4j.audit.PublisherThreadFactory)1 Test (org.junit.Test)1