protected void multiTopicConnectionListenerTest( String testName , CommTestParameters params , DummyMessageFactory msgFactory ) throws Exception
{
Topic topic = new TopicRef(params.destinationName);
SynchronizationPoint startSynchro = new SynchronizationPoint();
TopicConnection[] receiverConnections = new TopicConnection[params.receiverCount];
for (int n = 0 ; n < receiverConnections.length ; n++)
receiverConnections[n] = createTopicConnection();
// Start receivers
TopicListenerThread[] receivers = new TopicListenerThread[params.receiverCount];
for (int n = 0 ; n < receivers.length ; n++)
receivers[n] = new TopicListenerThread("Receiver"+(n+1),
startSynchro,
receiverConnections[n],
params.receiverTransacted,
params.acknowledgeMode,
topic,
null,
false);
for (int n = 0 ; n < receivers.length ; n++)
{
receivers[n].start();
receivers[n].waitForStartup();
}
TopicConnection[] sendersConnections = new TopicConnection[params.senderCount];
for (int n = 0 ; n < sendersConnections.length ; n++)
sendersConnections[n] = createTopicConnection();
// Start senders
TopicPublisherThread[] senders = new TopicPublisherThread[params.senderCount];
int totalExpected = params.messageCount*params.receiverCount;
for (int n = 0 ; n < senders.length ; n++)
{
senders[n] = new TopicPublisherThread("Sender"+(n+1),
msgFactory,
startSynchro,
sendersConnections[n],
params.senderTransacted,
params.messageCount/params.senderCount,
params.messageSize,
params.minDelay,
params.maxDelay,
topic,
params.deliveryMode,
params.priority,
params.timeToLive);
}
for (int n = 0 ; n < senders.length ; n++)
{
senders[n].start();
senders[n].waitForStartup();
}
for (int n = 0 ; n < receiverConnections.length ; n++)
receiverConnections[n].start();
long startTime = System.currentTimeMillis();
startSynchro.reach();
// Wait for senders to complete
for (int n = 0 ; n < senders.length ; n++)
senders[n].join(TestUtils.TEST_TIMEOUT*1000);
for (int n = 0 ; n < senders.length ; n++)