mirror of
https://github.com/apache/activemq.git
synced 2025-02-10 20:15:56 +00:00
r243@34: chirino | 2007-02-23 14:49:23 -0500
Disconnect failed connections quicker git-svn-id: https://svn.apache.org/repos/asf/activemq/branches/activemq-4.1@511087 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e0a8dede18
commit
043edbe4a0
@ -882,14 +882,15 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
|
||||
|
||||
// Clear out what's on the queue so that we can send the Shutdown command quicker.
|
||||
dispatchQueue.clear();
|
||||
dispatchAsync(new ShutdownInfo());
|
||||
|
||||
// Wait up to 10 seconds for the shutdown command to be sent to
|
||||
// the client.
|
||||
dispatchStopped.await(10, TimeUnit.SECONDS);
|
||||
if( transportException==null ) {
|
||||
// Wait up to 10 seconds for the shutdown command to be sent to
|
||||
// the client.
|
||||
dispatchAsync(new ShutdownInfo());
|
||||
dispatchStopped.await(10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
if( taskRunner!=null )
|
||||
taskRunner.shutdown();
|
||||
taskRunner.shutdownNoWait();
|
||||
|
||||
// Clear out the dispatch queue to release any memory that
|
||||
// is being held on to.
|
||||
|
@ -73,6 +73,19 @@ class DedicatedTaskRunner implements TaskRunner {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* shut down the task
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void shutdownNoWait() throws InterruptedException{
|
||||
synchronized(mutex){
|
||||
shutdown=true;
|
||||
pending=true;
|
||||
mutex.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void runTask() {
|
||||
|
||||
try {
|
||||
|
@ -90,6 +90,12 @@ class PooledTaskRunner implements TaskRunner {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdownNoWait() throws InterruptedException{
|
||||
synchronized(runable){
|
||||
shutdown=true;
|
||||
}
|
||||
}
|
||||
|
||||
private void runTask() {
|
||||
|
@ -25,4 +25,5 @@ package org.apache.activemq.thread;
|
||||
public interface TaskRunner {
|
||||
public abstract void wakeup() throws InterruptedException;
|
||||
public abstract void shutdown() throws InterruptedException;
|
||||
public abstract void shutdownNoWait() throws InterruptedException;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user