BUG-3219: clear queue array before stashing 83/20883/1
authorRobert Varga <rovarga@cisco.com>
Thu, 21 May 2015 11:05:15 +0000 (13:05 +0200)
committerRobert Varga <rovarga@cisco.com>
Thu, 21 May 2015 11:23:19 +0000 (13:23 +0200)
The queue should be cleared before stashing so as to not take the take
up memory.

Change-Id: I71c9a90e1ed9e4b7c7d47bb3e0785f67a8daf932
Signed-off-by: Robert Varga <rovarga@cisco.com>
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/OutboundQueueImpl.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/OutboundQueueManager.java

index c9c28c16769cdbf4a498bf92f37de0e1ea447971..ab3340bf36d5c45868fa3cd827d4fd9314f4db4c 100644 (file)
@@ -66,6 +66,9 @@ final class OutboundQueueImpl implements OutboundQueue {
         this.baseXid = baseXid;
         this.endXid = baseXid + queue.length;
         this.reserve = queue.length - 1;
+    }
+
+    void retire() {
         for (OutboundQueueEntry element : queue) {
             element.reset();
         }
index 609e23c16acf52616d113eda51dbc6423f185970..f2a4b0e551b9e84162aad8118a2651e11984a5d5 100644 (file)
@@ -109,6 +109,7 @@ final class OutboundQueueManager<T extends OutboundQueueHandler> extends Channel
 
     private void retireQueue(final OutboundQueueImpl queue) {
         if (queueCache.offer(queue)) {
+            queue.retire();
             LOG.trace("Saving queue {} for later reuse", queue);
         } else {
             LOG.trace("Queue {} thrown away", queue);