mirror of https://github.com/apache/jclouds.git
Purging the request queue on context destruction to avoid lingering queued tasks
This commit is contained in:
parent
57c0f19b00
commit
46a42c22d8
|
@ -87,6 +87,7 @@ public class SpringServletConfig extends LoggingConfig implements ServletConfigA
|
||||||
private Map<String, BlobStoreContext> providerTypeToBlobStoreMap;
|
private Map<String, BlobStoreContext> providerTypeToBlobStoreMap;
|
||||||
private Twitter twitterClient;
|
private Twitter twitterClient;
|
||||||
private String container;
|
private String container;
|
||||||
|
private Queue queue;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initialize() throws IOException {
|
public void initialize() throws IOException {
|
||||||
|
@ -119,7 +120,7 @@ public class SpringServletConfig extends LoggingConfig implements ServletConfigA
|
||||||
}
|
}
|
||||||
|
|
||||||
// get a queue for submitting store tweet requests
|
// get a queue for submitting store tweet requests
|
||||||
Queue queue = QueueFactory.getQueue("twitter");
|
queue = QueueFactory.getQueue("twitter");
|
||||||
// submit a job to store tweets for each configured blobstore
|
// submit a job to store tweets for each configured blobstore
|
||||||
for (String name : providerTypeToBlobStoreMap.keySet()) {
|
for (String name : providerTypeToBlobStoreMap.keySet()) {
|
||||||
queue.add(withUrl("/store/do").header("context", name).method(Method.GET));
|
queue.add(withUrl("/store/do").header("context", name).method(Method.GET));
|
||||||
|
@ -210,6 +211,9 @@ public class SpringServletConfig extends LoggingConfig implements ServletConfigA
|
||||||
context.close();
|
context.close();
|
||||||
}
|
}
|
||||||
logger.trace("Contexts closed.");
|
logger.trace("Contexts closed.");
|
||||||
|
logger.trace("About to purge request queue.");
|
||||||
|
queue.purge();
|
||||||
|
logger.trace("Request queue purged.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue