public void run() { PageContextImpl pci = (PageContextImpl) pc; Thread thread = pc.getThread(); pci.stop(t); int count = 0; if (thread.isAlive()) { do { if (count > 0 && log != null) { LogUtil.log( log, Log.LEVEL_ERROR, "", "could not stop the thread on the first approach", thread.getStackTrace()); } if (count++ > 10) break; // should never happen try { thread.stop(t); } catch (UnsupportedOperationException uoe) { LogUtil.log( log, Log.LEVEL_ERROR, "", "Thread.stop(Throwable) is not supported by this JVM and failed with UnsupportedOperationException", thread.getStackTrace()); thread.stop(); } SystemUtil.sleep(1000); } while (thread.isAlive() && pci.isInitialized()); } if (count > 10 && log != null) { LogUtil.log(log, Log.LEVEL_ERROR, "", "could not stop the thread", thread.getStackTrace()); aprint.e(thread.getStackTrace()); } }
public static void stop(PageContext pc, Log log) { stop(pc, new StopException(pc.getThread()), log); }