From 054f68c1775f2e04b45ac6c77a6fe658d054f002 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 19 May 2011 08:41:11 -0700 Subject: [PATCH] Fix deprecation warning for Thread.stop() Change-Id: Ib1957f3a50c5e65ab5680bb07b43efe368b85fa9 Signed-off-by: Shawn O. Pearce --- .../gerrit/server/patch/IntraLineLoader.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/IntraLineLoader.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/IntraLineLoader.java index 0ac1af2a18..358d3baa6e 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/IntraLineLoader.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/IntraLineLoader.java @@ -133,16 +133,21 @@ class IntraLineLoader extends EntryCreator { + " comparing " + key.getBlobA().name() // + ".." + key.getBlobB().name() // + ". Killing " + thread.getName()); - try { - thread.stop(); - } catch (Throwable error) { - // Ignore any reason the thread won't stop. - log.error("Cannot stop runaway thread " + thread.getName(), error); - } + forcefullyKillThreadInAnUglyWay(); 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() { if (!input.offer(Input.END_THREAD)) { log.error("Cannot gracefully stop thread " + thread.getName());