mirror of
https://github.com/apache/activemq.git
synced 2025-02-20 00:47:07 +00:00
clear down async tasks on stop
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@955168 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7a5abebea8
commit
e70308804f
@ -172,6 +172,9 @@ public class KahaDBStore extends MessageDatabase implements PersistenceAdapter{
|
|||||||
public void setMaxAsyncJobs(int maxAsyncJobs) {
|
public void setMaxAsyncJobs(int maxAsyncJobs) {
|
||||||
this.maxAsyncJobs = maxAsyncJobs;
|
this.maxAsyncJobs = maxAsyncJobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doStart() throws Exception {
|
public void doStart() throws Exception {
|
||||||
@ -200,12 +203,17 @@ public class KahaDBStore extends MessageDatabase implements PersistenceAdapter{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doStop(ServiceStopper stopper) throws Exception {
|
public void doStop(ServiceStopper stopper) throws Exception {
|
||||||
|
//drain down async jobs
|
||||||
|
LOG.info("Stopping async queue tasks");
|
||||||
|
this.globalQueueSemaphore.tryAcquire(this.maxAsyncJobs, 60, TimeUnit.SECONDS);
|
||||||
synchronized (this.asyncQueueMap) {
|
synchronized (this.asyncQueueMap) {
|
||||||
for (StoreQueueTask task : this.asyncQueueMap.values()) {
|
for (StoreQueueTask task : this.asyncQueueMap.values()) {
|
||||||
task.cancel();
|
task.cancel();
|
||||||
}
|
}
|
||||||
this.asyncQueueMap.clear();
|
this.asyncQueueMap.clear();
|
||||||
}
|
}
|
||||||
|
LOG.info("Stopping async topic tasks");
|
||||||
|
this.globalTopicSemaphore.tryAcquire(this.maxAsyncJobs, 60, TimeUnit.SECONDS);
|
||||||
synchronized (this.asyncTopicMap) {
|
synchronized (this.asyncTopicMap) {
|
||||||
for (StoreTopicTask task : this.asyncTopicMap.values()) {
|
for (StoreTopicTask task : this.asyncTopicMap.values()) {
|
||||||
task.cancel();
|
task.cancel();
|
||||||
@ -224,6 +232,7 @@ public class KahaDBStore extends MessageDatabase implements PersistenceAdapter{
|
|||||||
if (this.topicExecutor != null) {
|
if (this.topicExecutor != null) {
|
||||||
this.topicExecutor.shutdownNow();
|
this.topicExecutor.shutdownNow();
|
||||||
}
|
}
|
||||||
|
LOG.info("Stopped KahaDB");
|
||||||
super.doStop(stopper);
|
super.doStop(stopper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user