Timothy Bish 2014-01-22 10:09:38 -05:00
parent 90104943b2
commit dd0c9c4144
2 changed files with 11 additions and 12 deletions

View File

@ -435,17 +435,16 @@ class JobSchedulerImpl extends ServiceSupport implements Runnable, JobScheduler
for (Iterator<Map.Entry<Long, List<JobLocation>>> i = this.index.iterator(tx); i.hasNext();) { for (Iterator<Map.Entry<Long, List<JobLocation>>> i = this.index.iterator(tx); i.hasNext();) {
Map.Entry<Long, List<JobLocation>> entry = i.next(); Map.Entry<Long, List<JobLocation>> entry = i.next();
keys.add(entry.getKey()); keys.add(entry.getKey());
List<JobLocation> values = entry.getValue(); }
for (Long l : keys) {
List<JobLocation> values = this.index.remove(tx, l);
if (values != null) { if (values != null) {
for (JobLocation jl : values) { for (JobLocation jl : values) {
this.store.decrementJournalCount(tx, jl.getLocation()); this.store.decrementJournalCount(tx, jl.getLocation());
} }
} }
} }
for (Long l : keys) {
this.index.remove(tx, l);
}
} }
synchronized void destroy(Transaction tx, long start, long finish) throws IOException { synchronized void destroy(Transaction tx, long start, long finish) throws IOException {
@ -454,19 +453,18 @@ class JobSchedulerImpl extends ServiceSupport implements Runnable, JobScheduler
Map.Entry<Long, List<JobLocation>> entry = i.next(); Map.Entry<Long, List<JobLocation>> entry = i.next();
if (entry.getKey().longValue() <= finish) { if (entry.getKey().longValue() <= finish) {
keys.add(entry.getKey()); keys.add(entry.getKey());
List<JobLocation> values = entry.getValue();
if (values != null) {
for (JobLocation jl : values) {
this.store.decrementJournalCount(tx, jl.getLocation());
}
}
} else { } else {
break; break;
} }
} }
for (Long l : keys) { for (Long l : keys) {
this.index.remove(tx, l); List<JobLocation> values = this.index.remove(tx, l);
if (values != null) {
for (JobLocation jl : values) {
this.store.decrementJournalCount(tx, jl.getLocation());
}
}
} }
} }

View File

@ -252,6 +252,7 @@ public class JobSchedulerTest {
@After @After
public void tearDown() throws Exception { public void tearDown() throws Exception {
scheduler.stopDispatching();
store.stop(); store.stop();
} }
} }