From: Robert Varga Date: Thu, 21 May 2015 11:05:15 +0000 (+0200) Subject: BUG-3219: clear queue array before stashing X-Git-Tag: release/lithium~9 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=f84d1445e610bf985caa1c4e41c35954ea664b2c;p=openflowjava.git BUG-3219: clear queue array before stashing The queue should be cleared before stashing so as to not take the take up memory. Change-Id: I71c9a90e1ed9e4b7c7d47bb3e0785f67a8daf932 Signed-off-by: Robert Varga --- diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/OutboundQueueImpl.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/OutboundQueueImpl.java index c9c28c16..ab3340bf 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/OutboundQueueImpl.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/OutboundQueueImpl.java @@ -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(); } diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/OutboundQueueManager.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/OutboundQueueManager.java index 609e23c1..f2a4b0e5 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/OutboundQueueManager.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/OutboundQueueManager.java @@ -109,6 +109,7 @@ final class OutboundQueueManager 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);