From 3cf6011121e1db303606363f4d47078f863c2d54 Mon Sep 17 00:00:00 2001 From: wcrisman Date: Thu, 17 Jul 2014 14:28:08 -0700 Subject: [PATCH] Fixed bug in stopping the ThreadCreator when shutting down the ThreadService. --- Common/src/com/common/thread/ThreadService.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Common/src/com/common/thread/ThreadService.java b/Common/src/com/common/thread/ThreadService.java index 498169e..6c8fa67 100644 --- a/Common/src/com/common/thread/ThreadService.java +++ b/Common/src/com/common/thread/ThreadService.java @@ -146,10 +146,10 @@ public class ThreadService { //Wait until the thread is told to run again// try { //Make sure we don't have a target.// - if((target = getTarget()) == null) { + while((target = getTarget()) == null) { //Wait for the next run of this thread// wait(); - }//if// + }//while// }//try// catch(InterruptedException e) { return; @@ -283,9 +283,12 @@ private synchronized void _shutdown() { //Stop the thread creator.// if(threadCreator != null) { - threadCreator.stop(); + synchronized(threadCreator) { + threadCreator.stop(); + threadCreator.notifyAll(); + }//synchronized// + threadCreator = null; - notifyAll(); }//if// threadIterator = getThreadPool().iterator();