Fix deprecation warning for Thread.stop()
Change-Id: Ib1957f3a50c5e65ab5680bb07b43efe368b85fa9 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -133,16 +133,21 @@ class IntraLineLoader extends EntryCreator<IntraLineDiffKey, IntraLineDiff> {
|
|||||||
+ " comparing " + key.getBlobA().name() //
|
+ " comparing " + key.getBlobA().name() //
|
||||||
+ ".." + key.getBlobB().name() //
|
+ ".." + key.getBlobB().name() //
|
||||||
+ ". Killing " + thread.getName());
|
+ ". Killing " + thread.getName());
|
||||||
try {
|
forcefullyKillThreadInAnUglyWay();
|
||||||
thread.stop();
|
|
||||||
} catch (Throwable error) {
|
|
||||||
// Ignore any reason the thread won't stop.
|
|
||||||
log.error("Cannot stop runaway thread " + thread.getName(), error);
|
|
||||||
}
|
|
||||||
return Result.TIMEOUT;
|
return Result.TIMEOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
private void forcefullyKillThreadInAnUglyWay() {
|
||||||
|
try {
|
||||||
|
thread.stop();
|
||||||
|
} catch (Throwable error) {
|
||||||
|
// Ignore any reason the thread won't stop.
|
||||||
|
log.error("Cannot stop runaway thread " + thread.getName(), error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void end() {
|
void end() {
|
||||||
if (!input.offer(Input.END_THREAD)) {
|
if (!input.offer(Input.END_THREAD)) {
|
||||||
log.error("Cannot gracefully stop thread " + thread.getName());
|
log.error("Cannot gracefully stop thread " + thread.getName());
|
||||||
|
Reference in New Issue
Block a user