import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
-import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
private long tcpSelectorTimeout = 5000;
//how many times to search for an available socket
private int autoBind = 100;
- private int maxThreads = 15;
+ private int maxThreads = Integer.MAX_VALUE;
private int minThreads = 6;
private int maxTasks = 100;
private int minTasks = 10;
private int timeout = 3000; //3 seconds
private boolean useBufferPool = true;
- private Executor executor;
+ private ExecutorService executor;
public ReceiverBase() {
}
public void stop() {
- if ( executor instanceof ExecutorService ) ((ExecutorService)executor).shutdown();
+ if ( executor != null ) executor.shutdownNow();//ignore left overs
+ executor = null;
}
/**
return maxTasks;
}
- public Executor getExecutor() {
+ public ExecutorService getExecutor() {
return executor;
}
this.maxTasks = maxTasks;
}
- public void setExecutor(Executor executor) {
+ public void setExecutor(ExecutorService executor) {
this.executor = executor;
}
* @see org.apache.catalina.tribes.transport.ClusterReceiverBase#stopListening()
*/
protected void stopListening() {
- // Bugzilla 37529: http://issues.apache.org/bugzilla/show_bug.cgi?id=37529
setListen(false);
if (selector != null) {
try {
- for (int i = 0; i < getMaxThreads(); i++) {
- selector.wakeup();
- }
+ selector.wakeup();
selector.close();
} catch (Exception x) {
log.error("Unable to close cluster receiver selector.", x);