org.apache.qpid.test.unit.close
Class VerifyAckingOkDuringClose

java.lang.Object
  extended by org.apache.qpid.test.unit.close.VerifyAckingOkDuringClose

public class VerifyAckingOkDuringClose
extends Object

QPID-1791 The threading model in the Java broker (at least till 0.5) allows for the close to be handled immediately even if the broker is still processing state for that Session. This test verifys that QPID-1791 is has been handled. The problem was that the whilst the Session is busy processing Acks from the client the Close frame jumps in and clears the unAcknowledgeMap in an attempt to start processing them for closing the connection. If the session had a consumer consuming from a temporary queue. The closing thread dequeues and deletes the message that were on the uncknowledgedMap. However, the Acking thread currently does: queuEntry = unackedMap.get(messageID) dequeueAndDelete(queueEntry) unackedMap.remove(messageID) As a result the queueEntry is sitting in the unackedMap whilst it is being dequeuedAndDeleted which leaves the opportunity for the close thread to remove contents of the unackedMap for processing. The close thread will then dequeueAndDelete all these values one of which the acking thread is currently processing. Test Approach Send a lot of persistent messages (5000), the goal of which is to fill the pretch and to provide the broker with a lot of acks to process Using client ack and prefetch buffer of 5000 use receive to get 2500 Use AMQMessage.acknowledgeThis() to send a single ack frame back to the broker per message so 2500 ack frames. This will give the broker a lot to process, Immediately send the consumer close after the acks are all gone. This will cause the remaining 2500 prefetched messages plus any that have not yet had their acks processed to be collected by the requeue() process potentially


Field Summary
(package private) static int MESSAGE_SENT
           
 
Constructor Summary
VerifyAckingOkDuringClose()
           
 
Method Summary
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MESSAGE_SENT

static final int MESSAGE_SENT
See Also:
Constant Field Values
Constructor Detail

VerifyAckingOkDuringClose

public VerifyAckingOkDuringClose()
Method Detail

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Licensed to the Apache Software Foundation