Author: sebb Date: Thu Oct 9 09:09:05 2008 New Revision: 703194 URL: http://svn.apache.org/viewvc?rev=703194&view=rev Log: Remove serializable from inner class, and tidy up wait loop [The code does not appear to be used currently, but still...]
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java?rev=703194&r1=703193&r2=703194&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java (original) +++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java Thu Oct 9 09:09:05 2008 @@ -48,7 +48,7 @@ public class ThreadGroup extends AbstractTestElement implements SampleListener, Serializable, Controller { private final static Logger log = LoggingManager.getLoggerForClass(); - private static final long serialVersionUID = 232L; + private static final long serialVersionUID = 233L; public final static String NUM_THREADS = "ThreadGroup.num_threads"; @@ -296,6 +296,8 @@ getSamplerController().addTestElement(child); } + // TODO - does the ThreadGroup ever get any samples? Does it need to implement SampleListener? + /** * A sample has occurred. * @@ -334,11 +336,8 @@ * Separate thread to deliver all SampleEvents. This ensures that sample * listeners will get sample events one at a time and can thus ignore thread * issues. - * - * @author Mike Stover - * @version $Id$ */ - private class SampleQueue implements Runnable, Serializable { + private class SampleQueue implements Runnable { List occurredQ = Collections.synchronizedList(new LinkedList()); /** @@ -369,8 +368,8 @@ try { event = (SampleEvent) occurredQ.remove(0); } catch (Exception ex) { - waitForSamples(); - continue; + log.warn("Problem removing an item from the queue", ex); + // Drop thru to wait } try { if (event != null) { @@ -383,11 +382,15 @@ try { ((RemoteSampleListener) iter.next()).sampleOccurred(event); } catch (Exception ex) { - log.error("", ex); + log.error("Could not invoke sampleOccured on remote listener", ex); } } } else { - waitForSamples(); + try { + this.wait(); + } catch (Exception ex) { + log.warn("Error occured during wait", ex); + } } } catch (Throwable ex) { log.error("", ex); @@ -395,14 +398,6 @@ } } - - private synchronized void waitForSamples() { - try { - this.wait(); - } catch (Exception ex) { - log.error("", ex); - } - } } /* --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]