Skip to content

Commit

Permalink
Fix #63. Turns out I was overwriting the JGroups configuration by just
Browse files Browse the repository at this point in the history
setting up my own Executor, with its own arbitrary settings, in code.
This was falling back to the default rejection handler of Abort, which
was causing the exceptions. Fixed now so that the executor will use the
jgroups configured executor and the setting of "Run" will flow through.
  • Loading branch information
timpokorny committed Jan 23, 2015
1 parent 12b6c16 commit 545d3cc
Showing 1 changed file with 9 additions and 8 deletions.
Expand Up @@ -14,10 +14,7 @@
*/
package org.portico.bindings.jgroups.channel;

import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import org.apache.log4j.Logger;
import org.jgroups.JChannel;
Expand Down Expand Up @@ -203,11 +200,15 @@ private JChannel constructChannel() throws Exception
channel.getProtocolStack().getTransport().setTimerThreadFactory( factory );

// set the thread pools on the transport
LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>( 1000 );
Executor pool = new ThreadPoolExecutor(2, 10, 5000, TimeUnit.MILLISECONDS, queue, factory);
channel.getProtocolStack().getTransport().setDefaultThreadPool( pool );
channel.getProtocolStack().getTransport().setOOBThreadPool( pool );

ThreadPoolExecutor regular =
(ThreadPoolExecutor)channel.getProtocolStack().getTransport().getDefaultThreadPool();
regular.setThreadFactory( new DefaultThreadFactory(threadGroup,"Regular",true) );

// do the same for the oob pool
ThreadPoolExecutor oob =
(ThreadPoolExecutor)channel.getProtocolStack().getTransport().getOOBThreadPool();
oob.setThreadFactory( new DefaultThreadFactory(threadGroup,"OOB",true) );

return channel;
}

Expand Down

0 comments on commit 545d3cc

Please sign in to comment.