Paper bag fix BatchingProgressMonitor alarm queue

The alarm queue threads were started with an empty task body, which
meant the thread started and terminated immediately, leaving the
queue itself with no worker.

Change-Id: I2a9b5fe9c2bdff4a5e0f7ec7ad41a54b41a4ddd6
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Shawn O. Pearce 2011-03-01 10:06:39 -08:00
parent 268ccbebe3
commit bf1b970de1
1 changed files with 5 additions and 2 deletions

View File

@ -64,13 +64,16 @@ public abstract class BatchingProgressMonitor implements ProgressMonitor {
int threads = 1;
alarmQueue = new ScheduledThreadPoolExecutor(threads,
new ThreadFactory() {
private final ThreadFactory baseFactory = Executors
.defaultThreadFactory();
public Thread newThread(Runnable taskBody) {
Thread thr = new Thread("JGit-AlarmQueue");
Thread thr = baseFactory.newThread(taskBody);
thr.setName("JGit-AlarmQueue");
thr.setDaemon(true);
return thr;
}
});
alarmQueue.allowCoreThreadTimeOut(false);
alarmQueue.setMaximumPoolSize(alarmQueue.getCorePoolSize());
alarmQueue.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
alarmQueue.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);