}
};
final QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
Queue queue = (Queue)context.lookup(TEST_QUEUE);
QueueReceiver receiver = session.createReceiver(queue);
MessageListener listener =
new MessageListener()
{
long startTime = System.currentTimeMillis();
int i = 0;
/**
* #Description of the Method
*
* @param message Description of Parameter
*/
public void onMessage(Message message)
{
try
{
if( transacted == TRANS_INDIVIDUAL )
session.commit();
i++;
}
catch (JMSException e)
{
getLog().error("Unable to commit", e);
synchronized (this)
{
this.notify();
}
}
if (i >= iterationCount)
{
long endTime = System.currentTimeMillis();
long pTime = endTime - startTime;
log.debug(" received all messages in " + ((double)pTime / 1000) + " seconds. ");
synchronized (this)
{
this.notify();
}
}
}
};
getLog().debug(" Asynch Queue: This test will send " + getIterationCount() + " "
+ (persistence == DeliveryMode.PERSISTENT ? "persistent" : "non-persistent") + " messages. Each with a payload of "
+ ((double)PERFORMANCE_TEST_DATA_PAYLOAD.length / 1024) + "Kb"
+ " Session is " + TRANS_DESC[transacted] + " transacted");
long startTime = System.currentTimeMillis();
sendThread.start();
receiver.setMessageListener(listener);
synchronized (listener)
{
queueConnection.start();
listener.wait();
}