commit | 289ff7f5a3815704491e9509fe87d3e4f1614312 | [log] [tgz] |
---|---|---|
author | Deepa Vaddireddy <dvaddire@partner.ciena.com> | Wed Jan 04 09:34:23 2017 +0530 |
committer | Thomas Vachuska <tom@onlab.us> | Fri Jan 06 20:02:26 2017 +0000 |
tree | 5698575eb0b1152aab27afdc589e4834ec5b1bdc | |
parent | 4c6295e354f171edb8ae7d5233b60cce1ba132f1 [diff] |
Fix for ONOS-5783.java.lang.IllegalStateException: session is expired Change-Id: I540b3adb1a098b51bb8231ef724d5f4e19a24cc9
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorState.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorState.java index 33414e7..cb7d63a 100644 --- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorState.java +++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorState.java
@@ -125,9 +125,21 @@ * @param commit listen commit */ public void listen(Commit<? extends Listen> commit) { + Long sessionId = commit.session().id(); if (listeners.putIfAbsent(commit.session().id(), commit) != null) { commit.close(); } + commit.session() + .onStateChange( + state -> { + if (state == ServerSession.State.CLOSED + || state == ServerSession.State.EXPIRED) { + Commit<? extends Listen> listener = listeners.remove(sessionId); + if (listener != null) { + listener.close(); + } + } + }); } /**