fandyvon / activejdbc

Automatically exported from code.google.com/p/activejdbc
0 stars 0 forks source link

Handle InterruptedException correctly in org.javalite.activejdbc.statistics.StatisticsQueue because JVM does not want to stop #183

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
try {Thread.sleep(500);} catch (Exception e) {}

should be 

try {
    Thread.sleep(500);
} catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    return;
}

By the way StatisticsQueue.stop() will not work as expected due to 

    private boolean run = false;

it must be volatile.

I suggest to rewrite it completely using Executors.newFixedThreadPool(1), it 
doesn't consume resources if there is not any work to do, also it should be 
daemon to allow correct jvm shutdown without explicit call 
ExecutorService.shutdownNow()

Original issue reported on code.google.com by s...@expresspigeon.com on 13 Dec 2012 at 10:22

GoogleCodeExporter commented 9 years ago
fixed in rev 860, take a look

Original comment by vasyal...@gmail.com on 30 Dec 2012 at 8:37