Rework synchronization of SessionStateImpl 48/95948/5
authorOleksii Mozghovyi <oleksii.mozghovyi@pantheon.tech>
Mon, 26 Apr 2021 22:49:50 +0000 (01:49 +0300)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 10 May 2021 10:05:50 +0000 (12:05 +0200)
commitde6df3ea177d609faf693fe5c32479ba66998b7f
tree859d5e9dc2c2d46b095341ac61dab3e41f49c241
parent3bf063839d01f6c4b80aa4c02ea85d80feae8bfd
Rework synchronization of SessionStateImpl

SessionStateImpl is a simple state tracker, but its lifecycle was
needlessly complex due to it not being inherently tied to its session.

Make sure SessionStateImpl is instantiated only when we have a session,
which makes a number of operations clearer: we no longer need to deal
with partial initialization and need to protect only internal state.

While we are at it, simplify all of that by keeping simple longs
instead of LongAdder -- and use saturatedOf(long) to convert these to
Uint objects, preventing possible runtime exceptions when overflows
occur.

JIRA: BGPCEP-920
Change-Id: I57b33c7dc33fe63500f5ad96a80d39889c6c5a67
Signed-off-by: Oleksii Mozghovyi <oleksii.mozghovyi@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/AbstractTopologySessionListener.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/PCEPRequest.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/PCEPTopologySessionListener.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/session/stats/SessionStateImpl.java