This is the code I'm using to create my executor in my run method:
ExecutorService es = environment.lifecycle().executorService("sql")
.keepAliveTime(Duration.seconds(60))
.maxThreads(100) // has no effect with LinkedBlockingQueue!
.minThreads(100)
.workQueue(new LinkedBlockingQueue<>())
.build();
And here's the relevant code from my resource. The "dummy" query is
executing in the background on an Oracle DB and the "sku" query is
executing on the current thread on a MySql DB.
List<Future<Dummy>> dummyResults = new ArrayList<Future<Dummy>>();
for(String sku : skuNumbers) {
dummyResults.add(es.submit(new ConcurrentQuery(String.format("%-20s"
, sku))));
}
List<Sku> result = skuDao.getSkus(skuNumbers);
for(Future<Dummy> fut : dummyResults) {
try {
Dummy dummy = fut.get();
} catch (InterruptedException e) {
...
} catch (ExecutionException e) {
...
}
* If I execute the sku query *before* I submit the dummy queries,
everything works.
* If I execute the sku query *after* submitting the dummy queries but
*before* getting the dummy results, the sku query hangs in the MySql
driver. I have to kill -9 to recover.
* If I inject a 2 second sleep, allowing my dummy queries to fully complete
before I execute the sku query, it also works.
I'm running latest DropWizard with JDBI.
Can someone explain what's happening or give me some guidance to figure out
what's wrong?
--
You received this message because you are subscribed to the Google Groups
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.