Bug 2945: Fix read failures in StatAbstractListenCommit 84/17684/3
authorTom Pantelis <tpanteli@brocade.com>
Thu, 2 Apr 2015 19:53:37 +0000 (15:53 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Thu, 2 Apr 2015 21:43:52 +0000 (17:43 -0400)
commitc56ca24cedab4dee5eb544f787f84094bc8e50f9
treeac5cf3a0c101bb805ed503145d15c07527389f3c
parenta7a90199245cc8aca0c45d73cb7066b574e092de
Bug 2945: Fix read failures in StatAbstractListenCommit

Added a volatile currentReadTxStale flag which onDataChanged sets instead of
closing the currentReadTx. readLatestConfiguration checks the
currentReadTxStale flag and, if set, closes the currentReadTx and
creates a new one. This prevents onDataChanged from closing the Tx when
a read is in-flight.

Added a unit test class StatAbstractListenCommitTest with test cases for
the methods that were changed.

I also changed StatListenCommitFlow#initConfigFlows to create an
ArrayList when copying the Flow List as Linkedist incurs more memory
overhead.

Change-Id: I42e5b5d55eeddd62b0ffb002d35d07b664c91861
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
applications/statistics-manager/pom.xml
applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/statistics/manager/impl/StatAbstractListenCommit.java
applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/statistics/manager/impl/StatListenCommitFlow.java
applications/statistics-manager/src/test/java/org/opendaylight/openflowplugin/applications/statistics/manager/impl/StatAbstractListenCommitTest.java [new file with mode: 0644]