fix #2139 improve shutdown
This commit is contained in:
parent
390ac517c9
commit
1754e597a1
1 changed files with 8 additions and 1 deletions
|
@ -20,6 +20,7 @@ import java.io.IOException;
|
|||
import java.lang.management.ManagementFactory;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
@ -198,8 +199,14 @@ public class ThumbnailGenerator {
|
|||
count = ComponentUtil.getThumbnailManager().generate(executorService, options.cleanup);
|
||||
totalCount += count;
|
||||
}
|
||||
} finally {
|
||||
executorService.shutdown();
|
||||
executorService.awaitTermination(60, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Interrupted.", e);
|
||||
}
|
||||
} finally {
|
||||
executorService.shutdownNow();
|
||||
}
|
||||
return totalCount;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue