mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-24 13:51:27 +02:00
Distributed IntentStore family: relax state transition check
- allow INSTALLED -> INSTALLED - allow WITHDRWAN -> SUBMITTED Change-Id: I7ba9c7c6e29b39ce005fb15bfd68feb1751cb0af
This commit is contained in:
parent
0d33805a39
commit
89a7f47115
@ -56,7 +56,7 @@ public class DistributedIntentStore
|
||||
implements IntentStore {
|
||||
|
||||
/** Valid parking state, which can transition to INSTALLED. */
|
||||
private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(SUBMITTED, FAILED);
|
||||
private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(SUBMITTED, INSTALLED, FAILED);
|
||||
|
||||
/** Valid parking state, which can transition to WITHDRAWN. */
|
||||
private static final Set<IntentState> PRE_WITHDRAWN = EnumSet.of(INSTALLED, FAILED);
|
||||
@ -177,11 +177,16 @@ public class DistributedIntentStore
|
||||
switch (state) {
|
||||
case SUBMITTED:
|
||||
prevParking = states.get(id);
|
||||
verify(prevParking == null,
|
||||
"Illegal state transition attempted from %s to SUBMITTED",
|
||||
prevParking);
|
||||
updated = states.putIfAbsent(id, SUBMITTED);
|
||||
verify(updated, "Conditional replace %s => %s failed", prevParking, SUBMITTED);
|
||||
if (prevParking == null) {
|
||||
updated = states.putIfAbsent(id, SUBMITTED);
|
||||
verify(updated, "Conditional replace %s => %s failed", prevParking, SUBMITTED);
|
||||
} else {
|
||||
verify(prevParking == WITHDRAWN,
|
||||
"Illegal state transition attempted from %s to SUBMITTED",
|
||||
prevParking);
|
||||
updated = states.replace(id, prevParking, SUBMITTED);
|
||||
verify(updated, "Conditional replace %s => %s failed", prevParking, SUBMITTED);
|
||||
}
|
||||
type = IntentEvent.Type.SUBMITTED;
|
||||
break;
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ public class HazelcastIntentStore
|
||||
implements IntentStore {
|
||||
|
||||
/** Valid parking state, which can transition to INSTALLED. */
|
||||
private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(SUBMITTED, FAILED);
|
||||
private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(SUBMITTED, INSTALLED, FAILED);
|
||||
|
||||
/** Valid parking state, which can transition to WITHDRAWN. */
|
||||
private static final Set<IntentState> PRE_WITHDRAWN = EnumSet.of(INSTALLED, FAILED);
|
||||
@ -177,10 +177,17 @@ public class HazelcastIntentStore
|
||||
// parking state transition
|
||||
switch (state) {
|
||||
case SUBMITTED:
|
||||
prevParking = states.putIfAbsent(id, SUBMITTED);
|
||||
verify(prevParking == null,
|
||||
"Illegal state transition attempted from %s to SUBMITTED",
|
||||
prevParking);
|
||||
prevParking = states.get(id);
|
||||
if (prevParking == null) {
|
||||
IntentState existing = states.putIfAbsent(id, SUBMITTED);
|
||||
verify(existing != null, "Conditional replace %s => %s failed", prevParking, SUBMITTED);
|
||||
} else {
|
||||
verify(prevParking == WITHDRAWN,
|
||||
"Illegal state transition attempted from %s to SUBMITTED",
|
||||
prevParking);
|
||||
boolean updated = states.replace(id, prevParking, SUBMITTED);
|
||||
verify(updated, "Conditional replace %s => %s failed", prevParking, SUBMITTED);
|
||||
}
|
||||
type = IntentEvent.Type.SUBMITTED;
|
||||
break;
|
||||
case INSTALLED:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user