mirror of https://github.com/apache/lucene.git
SOLR-14162 TestInjection can leak Timer objects (#1137)
This commit is contained in:
parent
24f7a28ac1
commit
eaa3dbe440
|
@ -257,8 +257,9 @@ public class TestInjection {
|
|||
if (rand.nextBoolean()) {
|
||||
throw new TestShutdownFailError("Test exception for non graceful close");
|
||||
} else {
|
||||
|
||||
final Timer timer = new Timer();
|
||||
final Thread cthread = Thread.currentThread();
|
||||
|
||||
TimerTask task = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -275,11 +276,10 @@ public class TestInjection {
|
|||
}
|
||||
|
||||
cthread.interrupt();
|
||||
timers.remove(this);
|
||||
cancel();
|
||||
timers.remove(timer);
|
||||
}
|
||||
};
|
||||
Timer timer = new Timer();
|
||||
|
||||
timers.add(timer);
|
||||
timer.schedule(task, rand.nextInt(500));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue