Apache JMeter

org.apache.jmeter.timers
Class SyncTimer

java.lang.Object
  extended by org.apache.jmeter.testelement.AbstractTestElement
      extended by org.apache.jmeter.timers.SyncTimer
All Implemented Interfaces:
Serializable, Cloneable, Searchable, TestBean, TestElement, TestStateListener, ThreadListener, Timer

public class SyncTimer
extends AbstractTestElement
implements Timer, Serializable, TestBean, TestStateListener, ThreadListener

The purpose of the SyncTimer is to block threads until X number of threads have been blocked, and then they are all released at once. A SyncTimer can thus create large instant loads at various points of the test plan.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.apache.jmeter.testelement.TestElement
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS
 
Constructor Summary
SyncTimer()
           
 
Method Summary
 Object clone()
          We have to control the cloning process because we need some cross-thread communication if our synctimers are to be able to determine when to block and when to release.
 long delay()
          This method is called after a sampling process is done to know how much time the sampling thread has to wait until sampling again.
 int getGroupSize()
           
 long getTimeoutInMs()
           
 void setGroupSize(int numThreads)
           
 void setTimeoutInMs(long timeoutInMs)
           
 void testEnded()
           Called once for all threads after the end of a test.
 void testEnded(String host)
          Reset timerCounter
 void testStarted()
           Called just before the start of the test from the main engine thread.
 void testStarted(String host)
          Reset timerCounter
 void threadFinished()
          Called for each thread after all samples have been processed.
 void threadStarted()
          Called for each thread before starting sampling.
 
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncTimer

public SyncTimer()
Method Detail

getGroupSize

public int getGroupSize()
Returns:
Returns the numThreads.

setGroupSize

public void setGroupSize(int numThreads)
Parameters:
numThreads - The numThreads to set.

delay

public long delay()
This method is called after a sampling process is done to know how much time the sampling thread has to wait until sampling again.

Specified by:
delay in interface Timer
Returns:
the computed delay value.

clone

public Object clone()
We have to control the cloning process because we need some cross-thread communication if our synctimers are to be able to determine when to block and when to release.

Specified by:
clone in interface TestElement
Overrides:
clone in class AbstractTestElement

testEnded

public void testEnded()

Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
testEnded in interface TestStateListener
See Also:
StandardJMeterEngine.stopTest()

testEnded

public void testEnded(String host)
Reset timerCounter

Specified by:
testEnded in interface TestStateListener
Parameters:
host - name of host
See Also:
StandardJMeterEngine.stopTest()

testStarted

public void testStarted()

Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
testStarted in interface TestStateListener
See Also:
StandardJMeterEngine.run()

testStarted

public void testStarted(String host)
Reset timerCounter

Specified by:
testStarted in interface TestStateListener
Parameters:
host - name of host
See Also:
StandardJMeterEngine.run()

threadStarted

public void threadStarted()
Description copied from interface: ThreadListener
Called for each thread before starting sampling. WARNING: this is called before any Config test elements are processed, so any properties they define will not have been merged in yet.

Specified by:
threadStarted in interface ThreadListener
See Also:
JMeterThread.threadStarted()

threadFinished

public void threadFinished()
Description copied from interface: ThreadListener
Called for each thread after all samples have been processed.

Specified by:
threadFinished in interface ThreadListener
See Also:
JMeterThread.threadFinished(org.apache.jmeter.engine.event.LoopIterationListener)

getTimeoutInMs

public long getTimeoutInMs()
Returns:
the timeoutInMs

setTimeoutInMs

public void setTimeoutInMs(long timeoutInMs)
Parameters:
timeoutInMs - the timeoutInMs to set

Apache JMeter

Copyright © 1998-2014 Apache Software Foundation. All Rights Reserved.