mirror of
https://github.com/apache/activemq.git
synced 2025-02-17 07:24:51 +00:00
parent
232b8c51e9
commit
914beaeb4c
@ -22,7 +22,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class PooledTaskRunner implements TaskRunner {
|
class PooledTaskRunner implements TaskRunner {
|
||||||
|
|
||||||
@ -41,6 +41,7 @@ class PooledTaskRunner implements TaskRunner {
|
|||||||
this.maxIterationsPerRun = maxIterationsPerRun;
|
this.maxIterationsPerRun = maxIterationsPerRun;
|
||||||
this.task = task;
|
this.task = task;
|
||||||
runable = new Runnable() {
|
runable = new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
runningThread = Thread.currentThread();
|
runningThread = Thread.currentThread();
|
||||||
try {
|
try {
|
||||||
@ -56,6 +57,7 @@ class PooledTaskRunner implements TaskRunner {
|
|||||||
/**
|
/**
|
||||||
* We Expect MANY wakeup calls on the same TaskRunner.
|
* We Expect MANY wakeup calls on the same TaskRunner.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void wakeup() throws InterruptedException {
|
public void wakeup() throws InterruptedException {
|
||||||
synchronized (runable) {
|
synchronized (runable) {
|
||||||
|
|
||||||
@ -88,8 +90,9 @@ class PooledTaskRunner implements TaskRunner {
|
|||||||
*
|
*
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void shutdown(long timeout) throws InterruptedException {
|
public void shutdown(long timeout) throws InterruptedException {
|
||||||
LOG.trace("Shutdown timeout: {} task: {}", task);
|
LOG.trace("Shutdown timeout: {} task: {}", timeout, task);
|
||||||
synchronized (runable) {
|
synchronized (runable) {
|
||||||
shutdown = true;
|
shutdown = true;
|
||||||
// the check on the thread is done
|
// the check on the thread is done
|
||||||
@ -104,6 +107,7 @@ class PooledTaskRunner implements TaskRunner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void shutdown() throws InterruptedException {
|
public void shutdown() throws InterruptedException {
|
||||||
shutdown(0);
|
shutdown(0);
|
||||||
}
|
}
|
||||||
@ -132,7 +136,7 @@ class PooledTaskRunner implements TaskRunner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
synchronized( runable ) {
|
synchronized (runable) {
|
||||||
iterating = false;
|
iterating = false;
|
||||||
runable.notifyAll();
|
runable.notifyAll();
|
||||||
if (shutdown) {
|
if (shutdown) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user