Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.sampler
Class Producer  view Producer download Producer.java

java.lang.Object
  extended byorg.apache.jmeter.testelement.AbstractTestElement
      extended byorg.apache.jmeter.samplers.AbstractSampler
          extended byorg.activemq.sampler.Sampler
              extended byorg.activemq.sampler.Producer
All Implemented Interfaces:
java.lang.Cloneable, org.apache.jmeter.samplers.Sampler, java.io.Serializable, org.apache.jmeter.testelement.TestElement, org.apache.jmeter.testelement.TestListener

public class Producer
extends Sampler
implements org.apache.jmeter.testelement.TestListener

A sampler which understands Tcp requests.


Nested Class Summary
(package private)  class Producer.newThread
          Creates thread for publishing messages.
(package private)  class Producer.publish
          Starts the publish loop timer.
 
Field Summary
private  int batchCounter
           
static int counter
           
private static long INSECONDS
           
private static Logger log
           
private static long MSGINTERVALINSECS
           
private static java.lang.String STATUS_PREFIX
           
private static java.lang.String STATUS_PROPERTIES
           
private static java.lang.String STATUS_SUFFIX
           
private static java.util.Properties statusProps
           
private  java.util.Timer timerPublish
           
private  java.util.Timer timerPublishLoop
           
 
Fields inherited from class org.activemq.sampler.Sampler
ACTIVEMQ_SERVER, BATCHSIZE, CLASSNAME, CONFIG_SUBJECT, CONFIRM_SUBJECT, DEFMSGINTERVAL, DURABLE, duration, DURATION, embeddedBroker, ERRKEY, FILENAME, LAST_MESSAGE, MQSERVER, MSGINTERVAL, MSGSIZE, NOCONSUMER, NOMESSAGES, NOPRODUCER, NOSUBJECT, producers, protocolHandler, PUBLISH_MSG, ramp_up, RAMP_UP, stopThread, subjects, TCPKEY, TIMEOUT, TOOL_DEFAULT, TOPIC, tp, TRANSACTED, TRANSACTED_FALSE, URL
 
Fields inherited from class org.apache.jmeter.testelement.AbstractTestElement
 
Fields inherited from interface org.apache.jmeter.testelement.TestElement
ENABLED, GUI_CLASS, NAME, TEST_CLASS
 
Constructor Summary
Producer()
          Constructor for ProducerSampler object.
 
Method Summary
protected  void count(int count)
          Increments the int variable.
private static void displayToolParameters()
          Prints to the console the Producer tool parameters.
protected  java.lang.String getMessage()
           
static void main(java.lang.String[] args)
          Starts an instance of the Producer tool.
protected  void publish()
          Retrieves the message then sends it via tcp.
protected  void publish(java.lang.String text, java.lang.String subject)
          Sends the information from the client via tcp.
protected  void publishLoop(javax.jms.Session session, javax.jms.MessageProducer publisher, java.lang.String text)
          Sends a message through MessageProducer object.
static int resetCount()
           
 void run()
          Runs and publish the message.
 org.apache.jmeter.samplers.SampleResult sample(org.apache.jmeter.samplers.Entry e)
          Retrieves the sample as SampleResult object.
 void testEnded()
          Logs the end of the test.
 void testEnded(java.lang.String host)
          Logs the host at the end of the test.
 void testIterationStart(org.apache.jmeter.engine.event.LoopIterationEvent event)
          Logs the iteration event.
 void testStarted()
          Logs the start of the test.
 void testStarted(java.lang.String host)
          Logs the host at the start of the test.
 
Methods inherited from class org.activemq.sampler.Sampler
addResource, getBatchSize, getClass, getClassname, getConfigMessage, getConnection, getDefMsgInterval, getDurable, getDuration, getEmbeddedBroker, getFilename, getLabel, getMQServer, getMsgInterval, getMsgSize, getNoConsumer, getNoMessages, getNoProducer, getNoSubject, getProtocol, getPublisher, getRampUp, getSession, getSubjects, getTimeout, getTopic, getTransacted, getURL, getUsername, setBatchSize, setConnection, setDefMsgInterval, setDurable, setDuration, setEmbeddedBroker, setFilename, setMQServer, setMsgInterval, setMsgSize, setNoConsumer, setNoMessages, setNoProducer, setNoSubject, setPublisher, setRampUp, setSession, setTopic, setTransacted, setURL, start
 
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addProperty, addTestElement, canRemove, clear, clearTemporary, clone, emptyTemporary, equals, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, nextIsNull, propertyIterator, recoverRunningVersion, removeProperty, setName, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, threadFinished, threadStarted, traverse, traverseCollection, traverseMap, traverseProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jmeter.testelement.TestElement
addTestElement, canRemove, clear, clone, getProperty, getPropertyAsBoolean, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, threadFinished, threadStarted, traverse
 

Field Detail

counter

public static int counter

log

private static final Logger log

STATUS_PREFIX

private static final java.lang.String STATUS_PREFIX

STATUS_SUFFIX

private static final java.lang.String STATUS_SUFFIX

STATUS_PROPERTIES

private static final java.lang.String STATUS_PROPERTIES

statusProps

private static final java.util.Properties statusProps

INSECONDS

private static final long INSECONDS
See Also:
Constant Field Values

MSGINTERVALINSECS

private static final long MSGINTERVALINSECS
See Also:
Constant Field Values

timerPublish

private java.util.Timer timerPublish

timerPublishLoop

private java.util.Timer timerPublishLoop

batchCounter

private int batchCounter
Constructor Detail

Producer

public Producer()
Constructor for ProducerSampler object.

Method Detail

count

protected void count(int count)
Increments the int variable.


getMessage

protected java.lang.String getMessage()

publish

protected void publish()
                throws java.lang.Exception
Retrieves the message then sends it via tcp.


publish

protected void publish(java.lang.String text,
                       java.lang.String subject)
                throws javax.jms.JMSException
Sends the information from the client via tcp.


publishLoop

protected void publishLoop(javax.jms.Session session,
                           javax.jms.MessageProducer publisher,
                           java.lang.String text)
                    throws javax.jms.JMSException
Sends a message through MessageProducer object.


resetCount

public static int resetCount()

run

public void run()
         throws java.lang.Exception
Runs and publish the message.


sample

public org.apache.jmeter.samplers.SampleResult sample(org.apache.jmeter.samplers.Entry e)
Retrieves the sample as SampleResult object. There are times that this is ignored.

Specified by:
sample in interface org.apache.jmeter.samplers.Sampler
Overrides:
sample in class Sampler

testEnded

public void testEnded()
Logs the end of the test. This is called only once per class.

Specified by:
testEnded in interface org.apache.jmeter.testelement.TestListener

testEnded

public void testEnded(java.lang.String host)
Logs the host at the end of the test.

Specified by:
testEnded in interface org.apache.jmeter.testelement.TestListener

testStarted

public void testStarted()
Logs the start of the test. This is called only once per class.

Specified by:
testStarted in interface org.apache.jmeter.testelement.TestListener

testStarted

public void testStarted(java.lang.String host)
Logs the host at the start of the test. *

Specified by:
testStarted in interface org.apache.jmeter.testelement.TestListener

testIterationStart

public void testIterationStart(org.apache.jmeter.engine.event.LoopIterationEvent event)
Logs the iteration event.

Specified by:
testIterationStart in interface org.apache.jmeter.testelement.TestListener

main

public static void main(java.lang.String[] args)
Starts an instance of the Producer tool.


displayToolParameters

private static void displayToolParameters()
Prints to the console the Producer tool parameters.