Added WITHDRAW_REQ Intent State for ONOS-146
Fixed flow removed from other instance Change-Id: I22c88a447e26770fea8b7e23f4a78b1389077ad1
Showing
20 changed files
with
114 additions
and
114 deletions
... | @@ -136,7 +136,7 @@ public class FooComponent { | ... | @@ -136,7 +136,7 @@ public class FooComponent { |
136 | @Override | 136 | @Override |
137 | public void event(IntentEvent event) { | 137 | public void event(IntentEvent event) { |
138 | String message; | 138 | String message; |
139 | - if (event.type() == IntentEvent.Type.SUBMITTED) { | 139 | + if (event.type() == IntentEvent.Type.INSTALL_REQ) { |
140 | message = "WOW! It looks like someone has some intentions: {}"; | 140 | message = "WOW! It looks like someone has some intentions: {}"; |
141 | } else if (event.type() == IntentEvent.Type.INSTALLED) { | 141 | } else if (event.type() == IntentEvent.Type.INSTALLED) { |
142 | message = "AWESOME! So far things are going great: {}"; | 142 | message = "AWESOME! So far things are going great: {}"; | ... | ... |
... | @@ -134,7 +134,7 @@ public class IntentMetrics implements IntentMetricsService, | ... | @@ -134,7 +134,7 @@ public class IntentMetrics implements IntentMetricsService, |
134 | // an event equivalent of "Withdraw Requested" | 134 | // an event equivalent of "Withdraw Requested" |
135 | // | 135 | // |
136 | switch (event.type()) { | 136 | switch (event.type()) { |
137 | - case SUBMITTED: | 137 | + case INSTALL_REQ: |
138 | intentSubmittedEventMetric.eventReceived(); | 138 | intentSubmittedEventMetric.eventReceived(); |
139 | break; | 139 | break; |
140 | case INSTALLED: | 140 | case INSTALLED: | ... | ... |
... | @@ -31,9 +31,9 @@ public interface IntentMetricsService { | ... | @@ -31,9 +31,9 @@ public interface IntentMetricsService { |
31 | public List<IntentEvent> getEvents(); | 31 | public List<IntentEvent> getEvents(); |
32 | 32 | ||
33 | /** | 33 | /** |
34 | - * Gets the Event Metric for the intent SUBMITTED events. | 34 | + * Gets the Event Metric for the intent INSTALL_REQ events. |
35 | * | 35 | * |
36 | - * @return the Event Metric for the intent SUBMITTED events. | 36 | + * @return the Event Metric for the intent INSTALL_REQ events. |
37 | */ | 37 | */ |
38 | public EventMetric intentSubmittedEventMetric(); | 38 | public EventMetric intentSubmittedEventMetric(); |
39 | 39 | ... | ... |
... | @@ -94,7 +94,7 @@ public class OpticalPathProvisioner { | ... | @@ -94,7 +94,7 @@ public class OpticalPathProvisioner { |
94 | @Override | 94 | @Override |
95 | public void event(IntentEvent event) { | 95 | public void event(IntentEvent event) { |
96 | switch (event.type()) { | 96 | switch (event.type()) { |
97 | - case SUBMITTED: | 97 | + case INSTALL_REQ: |
98 | break; | 98 | break; |
99 | case INSTALLED: | 99 | case INSTALLED: |
100 | break; | 100 | break; | ... | ... |
... | @@ -245,7 +245,7 @@ public class IntentPushTestCommand extends AbstractShellCommand | ... | @@ -245,7 +245,7 @@ public class IntentPushTestCommand extends AbstractShellCommand |
245 | } else { | 245 | } else { |
246 | log.warn("install event latch is null"); | 246 | log.warn("install event latch is null"); |
247 | } | 247 | } |
248 | - } else if (event.type() != Type.SUBMITTED) { | 248 | + } else if (event.type() != Type.INSTALL_REQ) { |
249 | log.info("Unexpected intent event: {}", event); | 249 | log.info("Unexpected intent event: {}", event); |
250 | } | 250 | } |
251 | } | 251 | } | ... | ... |
... | @@ -246,7 +246,7 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -246,7 +246,7 @@ public class IntentsListCommand extends AbstractShellCommand { |
246 | void update(IntentState intentState) { | 246 | void update(IntentState intentState) { |
247 | total++; | 247 | total++; |
248 | switch (intentState) { | 248 | switch (intentState) { |
249 | - case SUBMITTED: | 249 | + case INSTALL_REQ: |
250 | submitted++; | 250 | submitted++; |
251 | break; | 251 | break; |
252 | case COMPILING: | 252 | case COMPILING: | ... | ... |
... | @@ -176,7 +176,6 @@ public class DefaultFlowRule implements FlowRule { | ... | @@ -176,7 +176,6 @@ public class DefaultFlowRule implements FlowRule { |
176 | if (obj instanceof DefaultFlowRule) { | 176 | if (obj instanceof DefaultFlowRule) { |
177 | DefaultFlowRule that = (DefaultFlowRule) obj; | 177 | DefaultFlowRule that = (DefaultFlowRule) obj; |
178 | return Objects.equals(deviceId, that.deviceId) && | 178 | return Objects.equals(deviceId, that.deviceId) && |
179 | - Objects.equals(id, that.id) && | ||
180 | Objects.equals(priority, that.priority) && | 179 | Objects.equals(priority, that.priority) && |
181 | Objects.equals(selector, that.selector); | 180 | Objects.equals(selector, that.selector); |
182 | 181 | ... | ... |
... | @@ -24,9 +24,9 @@ public class IntentEvent extends AbstractEvent<IntentEvent.Type, Intent> { | ... | @@ -24,9 +24,9 @@ public class IntentEvent extends AbstractEvent<IntentEvent.Type, Intent> { |
24 | 24 | ||
25 | public enum Type { | 25 | public enum Type { |
26 | /** | 26 | /** |
27 | - * Signifies that a new intent has been submitted to the system. | 27 | + * Signifies that an intent is to be installed or reinstalled. |
28 | */ | 28 | */ |
29 | - SUBMITTED, | 29 | + INSTALL_REQ, |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Signifies that an intent has been successfully installed. | 32 | * Signifies that an intent has been successfully installed. |
... | @@ -39,6 +39,11 @@ public class IntentEvent extends AbstractEvent<IntentEvent.Type, Intent> { | ... | @@ -39,6 +39,11 @@ public class IntentEvent extends AbstractEvent<IntentEvent.Type, Intent> { |
39 | FAILED, | 39 | FAILED, |
40 | 40 | ||
41 | /** | 41 | /** |
42 | + * Signifies that an intent will be withdrawn. | ||
43 | + */ | ||
44 | + WITHDRAW_REQ, | ||
45 | + | ||
46 | + /** | ||
42 | * Signifies that an intent has been withdrawn from the system. | 47 | * Signifies that an intent has been withdrawn from the system. |
43 | */ | 48 | */ |
44 | WITHDRAWN | 49 | WITHDRAWN |
... | @@ -70,12 +75,15 @@ public class IntentEvent extends AbstractEvent<IntentEvent.Type, Intent> { | ... | @@ -70,12 +75,15 @@ public class IntentEvent extends AbstractEvent<IntentEvent.Type, Intent> { |
70 | public static IntentEvent getEvent(IntentState state, Intent intent) { | 75 | public static IntentEvent getEvent(IntentState state, Intent intent) { |
71 | Type type; | 76 | Type type; |
72 | switch (state) { | 77 | switch (state) { |
73 | - case SUBMITTED: | 78 | + case INSTALL_REQ: |
74 | - type = Type.SUBMITTED; | 79 | + type = Type.INSTALL_REQ; |
75 | break; | 80 | break; |
76 | case INSTALLED: | 81 | case INSTALLED: |
77 | type = Type.INSTALLED; | 82 | type = Type.INSTALLED; |
78 | break; | 83 | break; |
84 | + case WITHDRAW_REQ: | ||
85 | + type = Type.WITHDRAW_REQ; | ||
86 | + break; | ||
79 | case WITHDRAWN: | 87 | case WITHDRAWN: |
80 | type = Type.WITHDRAWN; | 88 | type = Type.WITHDRAWN; |
81 | break; | 89 | break; | ... | ... |
... | @@ -26,9 +26,11 @@ public enum IntentState { | ... | @@ -26,9 +26,11 @@ public enum IntentState { |
26 | * local controller instance. | 26 | * local controller instance. |
27 | * <p> | 27 | * <p> |
28 | * All intent in the runtime take this state first. | 28 | * All intent in the runtime take this state first. |
29 | + * </p><p> | ||
30 | + * Intents will also pass through this state when they are updated. | ||
29 | * </p> | 31 | * </p> |
30 | */ | 32 | */ |
31 | - SUBMITTED, | 33 | + INSTALL_REQ, |
32 | 34 | ||
33 | /** | 35 | /** |
34 | * Signifies that the intent is being compiled into installable intents. | 36 | * Signifies that the intent is being compiled into installable intents. |
... | @@ -67,16 +69,11 @@ public enum IntentState { | ... | @@ -67,16 +69,11 @@ public enum IntentState { |
67 | RECOMPILING, | 69 | RECOMPILING, |
68 | 70 | ||
69 | /** | 71 | /** |
70 | - * TODO: Indicated that an intent will soon be recompiled. | ||
71 | - */ | ||
72 | - //UPDATE, | ||
73 | - | ||
74 | - /** | ||
75 | - * TODO. | ||
76 | * Indicates that an application has requested that an intent be withdrawn. | 72 | * Indicates that an application has requested that an intent be withdrawn. |
77 | - * It will start withdrawing short, but not necessarily on this instance. | 73 | + * It will start withdrawing shortly, but not necessarily on this instance. |
74 | + * Intents can also be parked here if it is impossible to withdraw them. | ||
78 | */ | 75 | */ |
79 | - //WITHDRAW_REQ, | 76 | + WITHDRAW_REQ, |
80 | 77 | ||
81 | /** | 78 | /** |
82 | * Indicates that the intent is being withdrawn. This is a transitional | 79 | * Indicates that the intent is being withdrawn. This is a transitional | ... | ... |
... | @@ -174,8 +174,8 @@ public class FakeIntentManager implements TestableIntentService { | ... | @@ -174,8 +174,8 @@ public class FakeIntentManager implements TestableIntentService { |
174 | @Override | 174 | @Override |
175 | public void submit(Intent intent) { | 175 | public void submit(Intent intent) { |
176 | intents.put(intent.id(), intent); | 176 | intents.put(intent.id(), intent); |
177 | - setState(intent, IntentState.SUBMITTED); | 177 | + setState(intent, IntentState.INSTALL_REQ); |
178 | - dispatch(new IntentEvent(IntentEvent.Type.SUBMITTED, intent)); | 178 | + dispatch(new IntentEvent(IntentEvent.Type.INSTALL_REQ, intent)); |
179 | executeSubmit(intent); | 179 | executeSubmit(intent); |
180 | } | 180 | } |
181 | 181 | ... | ... |
... | @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNull; | ... | @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNull; |
21 | import static org.junit.Assert.fail; | 21 | import static org.junit.Assert.fail; |
22 | import static org.onlab.onos.net.intent.IntentEvent.Type.FAILED; | 22 | import static org.onlab.onos.net.intent.IntentEvent.Type.FAILED; |
23 | import static org.onlab.onos.net.intent.IntentEvent.Type.INSTALLED; | 23 | import static org.onlab.onos.net.intent.IntentEvent.Type.INSTALLED; |
24 | -import static org.onlab.onos.net.intent.IntentEvent.Type.SUBMITTED; | 24 | +import static org.onlab.onos.net.intent.IntentEvent.Type.INSTALL_REQ; |
25 | import static org.onlab.onos.net.intent.IntentEvent.Type.WITHDRAWN; | 25 | import static org.onlab.onos.net.intent.IntentEvent.Type.WITHDRAWN; |
26 | 26 | ||
27 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
... | @@ -96,7 +96,7 @@ public class IntentServiceTest { | ... | @@ -96,7 +96,7 @@ public class IntentServiceTest { |
96 | }); | 96 | }); |
97 | 97 | ||
98 | // Make sure that all expected events have been emitted | 98 | // Make sure that all expected events have been emitted |
99 | - validateEvents(intent, SUBMITTED, INSTALLED); | 99 | + validateEvents(intent, INSTALL_REQ, INSTALLED); |
100 | 100 | ||
101 | // Make sure there is just one intent (and is ours) | 101 | // Make sure there is just one intent (and is ours) |
102 | assertEquals("incorrect intent count", 1, service.getIntentCount()); | 102 | assertEquals("incorrect intent count", 1, service.getIntentCount()); |
... | @@ -145,7 +145,7 @@ public class IntentServiceTest { | ... | @@ -145,7 +145,7 @@ public class IntentServiceTest { |
145 | }); | 145 | }); |
146 | 146 | ||
147 | // Make sure that all expected events have been emitted | 147 | // Make sure that all expected events have been emitted |
148 | - validateEvents(intent, SUBMITTED, FAILED); | 148 | + validateEvents(intent, INSTALL_REQ, FAILED); |
149 | } | 149 | } |
150 | 150 | ||
151 | @Test | 151 | @Test |
... | @@ -168,7 +168,7 @@ public class IntentServiceTest { | ... | @@ -168,7 +168,7 @@ public class IntentServiceTest { |
168 | }); | 168 | }); |
169 | 169 | ||
170 | // Make sure that all expected events have been emitted | 170 | // Make sure that all expected events have been emitted |
171 | - validateEvents(intent, SUBMITTED, FAILED); | 171 | + validateEvents(intent, INSTALL_REQ, FAILED); |
172 | } | 172 | } |
173 | 173 | ||
174 | /** | 174 | /** | ... | ... |
... | @@ -4,9 +4,6 @@ import org.onlab.onos.core.IdBlock; | ... | @@ -4,9 +4,6 @@ import org.onlab.onos.core.IdBlock; |
4 | import org.onlab.onos.core.IdBlockStore; | 4 | import org.onlab.onos.core.IdBlockStore; |
5 | 5 | ||
6 | public class StoreBasedIdBlockAllocator implements IdBlockAllocator { | 6 | public class StoreBasedIdBlockAllocator implements IdBlockAllocator { |
7 | - private long blockTop; | ||
8 | - private static final long BLOCK_SIZE = 0x1000000L; | ||
9 | - | ||
10 | private final IdBlockStore store; | 7 | private final IdBlockStore store; |
11 | private final String topic; | 8 | private final String topic; |
12 | 9 | ... | ... |
... | @@ -38,7 +38,6 @@ import org.onlab.onos.net.intent.IntentBatchDelegate; | ... | @@ -38,7 +38,6 @@ import org.onlab.onos.net.intent.IntentBatchDelegate; |
38 | import org.onlab.onos.net.intent.IntentBatchService; | 38 | import org.onlab.onos.net.intent.IntentBatchService; |
39 | import org.onlab.onos.net.intent.IntentCompiler; | 39 | import org.onlab.onos.net.intent.IntentCompiler; |
40 | import org.onlab.onos.net.intent.IntentEvent; | 40 | import org.onlab.onos.net.intent.IntentEvent; |
41 | -import org.onlab.onos.net.intent.IntentEvent.Type; | ||
42 | import org.onlab.onos.net.intent.IntentException; | 41 | import org.onlab.onos.net.intent.IntentException; |
43 | import org.onlab.onos.net.intent.IntentExtensionService; | 42 | import org.onlab.onos.net.intent.IntentExtensionService; |
44 | import org.onlab.onos.net.intent.IntentId; | 43 | import org.onlab.onos.net.intent.IntentId; |
... | @@ -87,6 +86,12 @@ public class IntentManager | ... | @@ -87,6 +86,12 @@ public class IntentManager |
87 | 86 | ||
88 | private static final int NUM_THREADS = 12; | 87 | private static final int NUM_THREADS = 12; |
89 | 88 | ||
89 | + private static final EnumSet<IntentState> RECOMPILE | ||
90 | + = EnumSet.of(INSTALL_REQ, FAILED, WITHDRAW_REQ); | ||
91 | + private static final EnumSet<IntentState> NON_PARKED_OR_FAILED | ||
92 | + = EnumSet.complementOf(EnumSet.of(INSTALL_REQ, INSTALLED, WITHDRAW_REQ, WITHDRAWN)); | ||
93 | + | ||
94 | + | ||
90 | // Collections for compiler, installer, and listener are ONOS instance local | 95 | // Collections for compiler, installer, and listener are ONOS instance local |
91 | private final ConcurrentMap<Class<? extends Intent>, | 96 | private final ConcurrentMap<Class<? extends Intent>, |
92 | IntentCompiler<? extends Intent>> compilers = new ConcurrentHashMap<>(); | 97 | IntentCompiler<? extends Intent>> compilers = new ConcurrentHashMap<>(); |
... | @@ -510,13 +515,18 @@ public class IntentManager | ... | @@ -510,13 +515,18 @@ public class IntentManager |
510 | if (compileAllFailed) { | 515 | if (compileAllFailed) { |
511 | // If required, compile all currently failed intents. | 516 | // If required, compile all currently failed intents. |
512 | for (Intent intent : getIntents()) { | 517 | for (Intent intent : getIntents()) { |
513 | - if (getIntentState(intent.id()) == FAILED) { | 518 | + IntentState state = getIntentState(intent.id()); |
519 | + if (RECOMPILE.contains(state)) { | ||
514 | IntentOperations.Builder builder = batches.get(intent.appId()); | 520 | IntentOperations.Builder builder = batches.get(intent.appId()); |
515 | if (builder == null) { | 521 | if (builder == null) { |
516 | builder = IntentOperations.builder(intent.appId()); | 522 | builder = IntentOperations.builder(intent.appId()); |
517 | batches.put(intent.appId(), builder); | 523 | batches.put(intent.appId(), builder); |
518 | } | 524 | } |
519 | - builder.addUpdateOperation(intent.id()); | 525 | + if (state == WITHDRAW_REQ) { |
526 | + builder.addWithdrawOperation(intent.id()); | ||
527 | + } else { | ||
528 | + builder.addUpdateOperation(intent.id()); | ||
529 | + } | ||
520 | } | 530 | } |
521 | } | 531 | } |
522 | } | 532 | } |
... | @@ -607,15 +617,18 @@ public class IntentManager | ... | @@ -607,15 +617,18 @@ public class IntentManager |
607 | } else { | 617 | } else { |
608 | oldInstallables = null; | 618 | oldInstallables = null; |
609 | if (newIntent == null) { | 619 | if (newIntent == null) { |
610 | - log.info("Ignoring {} for Intent {}", op.type(), op.intentId()); | 620 | + log.info("Ignoring {} for missing Intent {}", op.type(), op.intentId()); |
611 | } | 621 | } |
612 | } | 622 | } |
613 | } | 623 | } |
614 | 624 | ||
615 | void init(BatchWrite batchWrite) { | 625 | void init(BatchWrite batchWrite) { |
616 | - // add new intent to store (if required) | ||
617 | if (newIntent != null) { | 626 | if (newIntent != null) { |
627 | + // TODO consider only "creating" intent if it does not exist | ||
628 | + // Note: We need to set state to INSTALL_REQ regardless. | ||
618 | batchWrite.createIntent(newIntent); | 629 | batchWrite.createIntent(newIntent); |
630 | + } else if (oldIntent != null && !oldIntent.equals(newIntent)) { | ||
631 | + batchWrite.setState(oldIntent, WITHDRAW_REQ); | ||
619 | } | 632 | } |
620 | } | 633 | } |
621 | 634 | ||
... | @@ -637,10 +650,6 @@ public class IntentManager | ... | @@ -637,10 +650,6 @@ public class IntentManager |
637 | 650 | ||
638 | void setInstallables(List<Intent> installables) { | 651 | void setInstallables(List<Intent> installables) { |
639 | newInstallables = installables; | 652 | newInstallables = installables; |
640 | - //FIXME batch this | ||
641 | - | ||
642 | - //store.setInstallableIntents(newIntent.id(), installables); | ||
643 | - | ||
644 | } | 653 | } |
645 | 654 | ||
646 | boolean isComplete() { | 655 | boolean isComplete() { |
... | @@ -659,7 +668,6 @@ public class IntentManager | ... | @@ -659,7 +668,6 @@ public class IntentManager |
659 | } | 668 | } |
660 | 669 | ||
661 | void batchFailed() { | 670 | void batchFailed() { |
662 | - | ||
663 | // the current batch has failed, so recompile | 671 | // the current batch has failed, so recompile |
664 | // remove the current batch and all remaining | 672 | // remove the current batch and all remaining |
665 | for (int i = currentBatch; i < batches.size(); i++) { | 673 | for (int i = currentBatch; i < batches.size(); i++) { |
... | @@ -673,10 +681,10 @@ public class IntentManager | ... | @@ -673,10 +681,10 @@ public class IntentManager |
673 | batches.addAll(uninstallIntent(newIntent, newInstallables())); | 681 | batches.addAll(uninstallIntent(newIntent, newInstallables())); |
674 | } | 682 | } |
675 | 683 | ||
676 | - // FIXME: should we try to recompile? | 684 | + // TODO we might want to try to recompile the new intent |
677 | } | 685 | } |
678 | 686 | ||
679 | - // FIXME make sure this is called!!! | 687 | + // make sure this is called!!! |
680 | private void finalizeStates(BatchWrite batchWrite) { | 688 | private void finalizeStates(BatchWrite batchWrite) { |
681 | // events to be triggered on successful write | 689 | // events to be triggered on successful write |
682 | for (Intent intent : stateMap.keySet()) { | 690 | for (Intent intent : stateMap.keySet()) { |
... | @@ -695,9 +703,10 @@ public class IntentManager | ... | @@ -695,9 +703,10 @@ public class IntentManager |
695 | break; | 703 | break; |
696 | 704 | ||
697 | // FALLTHROUGH to default from here | 705 | // FALLTHROUGH to default from here |
698 | - case SUBMITTED: | 706 | + case INSTALL_REQ: |
699 | case COMPILING: | 707 | case COMPILING: |
700 | case RECOMPILING: | 708 | case RECOMPILING: |
709 | + case WITHDRAW_REQ: | ||
701 | case WITHDRAWN: | 710 | case WITHDRAWN: |
702 | case INSTALLED: | 711 | case INSTALLED: |
703 | default: | 712 | default: |
... | @@ -708,10 +717,6 @@ public class IntentManager | ... | @@ -708,10 +717,6 @@ public class IntentManager |
708 | } | 717 | } |
709 | } | 718 | } |
710 | 719 | ||
711 | - List<FlowRuleBatchOperation> batches() { | ||
712 | - return batches; | ||
713 | - } | ||
714 | - | ||
715 | void addBatches(List<FlowRuleBatchOperation> batches) { | 720 | void addBatches(List<FlowRuleBatchOperation> batches) { |
716 | this.batches.addAll(batches); | 721 | this.batches.addAll(batches); |
717 | } | 722 | } |
... | @@ -720,31 +725,19 @@ public class IntentManager | ... | @@ -720,31 +725,19 @@ public class IntentManager |
720 | return stateMap.get(intent); | 725 | return stateMap.get(intent); |
721 | } | 726 | } |
722 | 727 | ||
723 | - | ||
724 | // set transient state during intent update process | 728 | // set transient state during intent update process |
725 | void setInflightState(Intent intent, IntentState newState) { | 729 | void setInflightState(Intent intent, IntentState newState) { |
726 | // This method should be called for | 730 | // This method should be called for |
727 | // transition to non-parking or Failed only | 731 | // transition to non-parking or Failed only |
728 | - EnumSet<IntentState> nonParkingOrFailed | 732 | + if (!NON_PARKED_OR_FAILED.contains(newState)) { |
729 | - = EnumSet.complementOf(EnumSet.of(SUBMITTED, INSTALLED, WITHDRAWN)); | ||
730 | - if (!nonParkingOrFailed.contains(newState)) { | ||
731 | log.error("Unexpected transition to {}", newState); | 733 | log.error("Unexpected transition to {}", newState); |
732 | } | 734 | } |
733 | 735 | ||
734 | - // TODO: clean this up, or set to debug | ||
735 | IntentState oldState = stateMap.get(intent); | 736 | IntentState oldState = stateMap.get(intent); |
736 | log.debug("intent id: {}, old state: {}, new state: {}", | 737 | log.debug("intent id: {}, old state: {}, new state: {}", |
737 | intent.id(), oldState, newState); | 738 | intent.id(), oldState, newState); |
738 | 739 | ||
739 | stateMap.put(intent, newState); | 740 | stateMap.put(intent, newState); |
740 | -// IntentEvent event = store.setState(intent, newState); | ||
741 | -// if (event != null) { | ||
742 | -// eventDispatcher.post(event); | ||
743 | -// } | ||
744 | - } | ||
745 | - | ||
746 | - Map<Intent, IntentState> stateMap() { | ||
747 | - return stateMap; | ||
748 | } | 741 | } |
749 | } | 742 | } |
750 | 743 | ||
... | @@ -790,12 +783,6 @@ public class IntentManager | ... | @@ -790,12 +783,6 @@ public class IntentManager |
790 | 783 | ||
791 | // start processing each Intents | 784 | // start processing each Intents |
792 | for (IntentUpdate update : intentUpdates) { | 785 | for (IntentUpdate update : intentUpdates) { |
793 | - if (update.newIntent() != null) { | ||
794 | - IntentState state = store.getIntentState(update.newIntent().id()); | ||
795 | - if (state == SUBMITTED) { | ||
796 | - eventDispatcher.post(new IntentEvent(Type.SUBMITTED, update.newIntent)); | ||
797 | - } | ||
798 | - } | ||
799 | processIntentUpdate(update); | 786 | processIntentUpdate(update); |
800 | } | 787 | } |
801 | future = applyNextBatch(); | 788 | future = applyNextBatch(); |
... | @@ -820,15 +807,11 @@ public class IntentManager | ... | @@ -820,15 +807,11 @@ public class IntentManager |
820 | private void updateBatches(CompletedBatchOperation completed) { | 807 | private void updateBatches(CompletedBatchOperation completed) { |
821 | if (completed.isSuccess()) { | 808 | if (completed.isSuccess()) { |
822 | BatchWrite batchWrite = store.newBatchWrite(); | 809 | BatchWrite batchWrite = store.newBatchWrite(); |
823 | - List<IntentEvent> events = new ArrayList<>(); | ||
824 | for (IntentUpdate update : intentUpdates) { | 810 | for (IntentUpdate update : intentUpdates) { |
825 | update.batchSuccess(batchWrite); | 811 | update.batchSuccess(batchWrite); |
826 | } | 812 | } |
827 | if (!batchWrite.isEmpty()) { | 813 | if (!batchWrite.isEmpty()) { |
828 | store.batchWrite(batchWrite); | 814 | store.batchWrite(batchWrite); |
829 | - for (IntentEvent event : events) { | ||
830 | - eventDispatcher.post(event); | ||
831 | - } | ||
832 | } | 815 | } |
833 | } else { | 816 | } else { |
834 | // entire batch has been reverted... | 817 | // entire batch has been reverted... |
... | @@ -851,6 +834,13 @@ public class IntentManager | ... | @@ -851,6 +834,13 @@ public class IntentManager |
851 | } | 834 | } |
852 | } | 835 | } |
853 | 836 | ||
837 | + private void abandonShip() { | ||
838 | + // the batch has failed | ||
839 | + // TODO: maybe we should do more? | ||
840 | + future = null; | ||
841 | + log.error("Walk the plank, matey..."); | ||
842 | + } | ||
843 | + | ||
854 | /** | 844 | /** |
855 | * Iterate through the pending futures, and remove them when they have completed. | 845 | * Iterate through the pending futures, and remove them when they have completed. |
856 | */ | 846 | */ |
... | @@ -863,9 +853,11 @@ public class IntentManager | ... | @@ -863,9 +853,11 @@ public class IntentManager |
863 | CompletedBatchOperation completed = future.get(100, TimeUnit.NANOSECONDS); | 853 | CompletedBatchOperation completed = future.get(100, TimeUnit.NANOSECONDS); |
864 | updateBatches(completed); | 854 | updateBatches(completed); |
865 | future = applyNextBatch(); | 855 | future = applyNextBatch(); |
866 | - } catch (TimeoutException | InterruptedException | ExecutionException te) { | 856 | + } catch (TimeoutException | InterruptedException te) { |
867 | - //TODO look into error message | 857 | + log.trace("Installation of intents are still pending: {}", ops); |
868 | - log.debug("Installation of intents are still pending: {}", ops); | 858 | + } catch (ExecutionException e) { |
859 | + log.warn("Execution of batch failed: {}", ops, e); | ||
860 | + abandonShip(); | ||
869 | } | 861 | } |
870 | } | 862 | } |
871 | 863 | ||
... | @@ -893,7 +885,6 @@ public class IntentManager | ... | @@ -893,7 +885,6 @@ public class IntentManager |
893 | } | 885 | } |
894 | 886 | ||
895 | boolean isComplete() { | 887 | boolean isComplete() { |
896 | - // TODO: actually check with the intent update? | ||
897 | return future == null; | 888 | return future == null; |
898 | } | 889 | } |
899 | 890 | ... | ... |
... | @@ -130,11 +130,11 @@ public class IntentManagerTest { | ... | @@ -130,11 +130,11 @@ public class IntentManagerTest { |
130 | public void submitIntent() { | 130 | public void submitIntent() { |
131 | flowRuleService.setFuture(true); | 131 | flowRuleService.setFuture(true); |
132 | 132 | ||
133 | - listener.setLatch(1, Type.SUBMITTED); | 133 | + listener.setLatch(1, Type.INSTALL_REQ); |
134 | listener.setLatch(1, Type.INSTALLED); | 134 | listener.setLatch(1, Type.INSTALLED); |
135 | Intent intent = new MockIntent(MockIntent.nextId()); | 135 | Intent intent = new MockIntent(MockIntent.nextId()); |
136 | service.submit(intent); | 136 | service.submit(intent); |
137 | - listener.await(Type.SUBMITTED); | 137 | + listener.await(Type.INSTALL_REQ); |
138 | listener.await(Type.INSTALLED); | 138 | listener.await(Type.INSTALLED); |
139 | assertEquals(1L, service.getIntentCount()); | 139 | assertEquals(1L, service.getIntentCount()); |
140 | assertEquals(1L, flowRuleService.getFlowRuleCount()); | 140 | assertEquals(1L, flowRuleService.getFlowRuleCount()); |
... | @@ -194,7 +194,7 @@ public class IntentManagerTest { | ... | @@ -194,7 +194,7 @@ public class IntentManagerTest { |
194 | 194 | ||
195 | MockIntent intent2 = new MockIntent(MockIntent.nextId()); | 195 | MockIntent intent2 = new MockIntent(MockIntent.nextId()); |
196 | listener.setLatch(1, Type.WITHDRAWN); | 196 | listener.setLatch(1, Type.WITHDRAWN); |
197 | - listener.setLatch(1, Type.SUBMITTED); | 197 | + listener.setLatch(1, Type.INSTALL_REQ); |
198 | listener.setLatch(1, Type.INSTALLED); | 198 | listener.setLatch(1, Type.INSTALLED); |
199 | service.replace(intent.id(), intent2); | 199 | service.replace(intent.id(), intent2); |
200 | listener.await(Type.WITHDRAWN); | 200 | listener.await(Type.WITHDRAWN); | ... | ... |
... | @@ -35,7 +35,7 @@ import java.util.Map; | ... | @@ -35,7 +35,7 @@ import java.util.Map; |
35 | @Service | 35 | @Service |
36 | public class DistributedIdBlockStore implements IdBlockStore { | 36 | public class DistributedIdBlockStore implements IdBlockStore { |
37 | 37 | ||
38 | - private static final long DEFAULT_BLOCK_SIZE = 1000L; | 38 | + private static final long DEFAULT_BLOCK_SIZE = 0x1000L; |
39 | 39 | ||
40 | protected Map<String, IAtomicLong> topicBlocks; | 40 | protected Map<String, IAtomicLong> topicBlocks; |
41 | 41 | ... | ... |
... | @@ -73,12 +73,12 @@ public class DistributedIntentStore | ... | @@ -73,12 +73,12 @@ public class DistributedIntentStore |
73 | implements IntentStore, MetricsHelper { | 73 | implements IntentStore, MetricsHelper { |
74 | 74 | ||
75 | /** Valid parking state, which can transition to INSTALLED. */ | 75 | /** Valid parking state, which can transition to INSTALLED. */ |
76 | - private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(SUBMITTED, INSTALLED, FAILED); | 76 | + private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(INSTALL_REQ, INSTALLED, FAILED); |
77 | 77 | ||
78 | /** Valid parking state, which can transition to WITHDRAWN. */ | 78 | /** Valid parking state, which can transition to WITHDRAWN. */ |
79 | private static final Set<IntentState> PRE_WITHDRAWN = EnumSet.of(INSTALLED, FAILED); | 79 | private static final Set<IntentState> PRE_WITHDRAWN = EnumSet.of(INSTALLED, FAILED); |
80 | 80 | ||
81 | - private static final Set<IntentState> PARKING = EnumSet.of(SUBMITTED, INSTALLED, WITHDRAWN, FAILED); | 81 | + private static final Set<IntentState> PARKING = EnumSet.of(INSTALL_REQ, INSTALLED, WITHDRAWN, FAILED); |
82 | 82 | ||
83 | private final Logger log = getLogger(getClass()); | 83 | private final Logger log = getLogger(getClass()); |
84 | 84 | ||
... | @@ -196,7 +196,7 @@ public class DistributedIntentStore | ... | @@ -196,7 +196,7 @@ public class DistributedIntentStore |
196 | // duplicate, ignore | 196 | // duplicate, ignore |
197 | return; | 197 | return; |
198 | } else { | 198 | } else { |
199 | - this.setState(intent, IntentState.SUBMITTED); | 199 | + this.setState(intent, IntentState.INSTALL_REQ); |
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | } finally { | 202 | } finally { |
... | @@ -286,19 +286,19 @@ public class DistributedIntentStore | ... | @@ -286,19 +286,19 @@ public class DistributedIntentStore |
286 | 286 | ||
287 | // parking state transition | 287 | // parking state transition |
288 | switch (state) { | 288 | switch (state) { |
289 | - case SUBMITTED: | 289 | + case INSTALL_REQ: |
290 | prevParking = states.get(id); | 290 | prevParking = states.get(id); |
291 | if (prevParking == null) { | 291 | if (prevParking == null) { |
292 | - updated = states.putIfAbsent(id, SUBMITTED); | 292 | + updated = states.putIfAbsent(id, INSTALL_REQ); |
293 | - verify(updated, "Conditional replace %s => %s failed", prevParking, SUBMITTED); | 293 | + verify(updated, "Conditional replace %s => %s failed", prevParking, INSTALL_REQ); |
294 | } else { | 294 | } else { |
295 | verify(prevParking == WITHDRAWN, | 295 | verify(prevParking == WITHDRAWN, |
296 | - "Illegal state transition attempted from %s to SUBMITTED", | 296 | + "Illegal state transition attempted from %s to INSTALL_REQ", |
297 | prevParking); | 297 | prevParking); |
298 | - updated = states.replace(id, prevParking, SUBMITTED); | 298 | + updated = states.replace(id, prevParking, INSTALL_REQ); |
299 | - verify(updated, "Conditional replace %s => %s failed", prevParking, SUBMITTED); | 299 | + verify(updated, "Conditional replace %s => %s failed", prevParking, INSTALL_REQ); |
300 | } | 300 | } |
301 | - evtType = IntentEvent.Type.SUBMITTED; | 301 | + evtType = IntentEvent.Type.INSTALL_REQ; |
302 | break; | 302 | break; |
303 | 303 | ||
304 | case INSTALLED: | 304 | case INSTALLED: |
... | @@ -430,8 +430,8 @@ public class DistributedIntentStore | ... | @@ -430,8 +430,8 @@ public class DistributedIntentStore |
430 | "CREATE_INTENT takes 1 argument. %s", op); | 430 | "CREATE_INTENT takes 1 argument. %s", op); |
431 | Intent intent = op.arg(0); | 431 | Intent intent = op.arg(0); |
432 | builder.putIfAbsent(INTENTS_TABLE, strIntentId(intent.id()), serializer.encode(intent)); | 432 | builder.putIfAbsent(INTENTS_TABLE, strIntentId(intent.id()), serializer.encode(intent)); |
433 | - builder.putIfAbsent(STATES_TABLE, strIntentId(intent.id()), serializer.encode(SUBMITTED)); | 433 | + builder.putIfAbsent(STATES_TABLE, strIntentId(intent.id()), serializer.encode(INSTALL_REQ)); |
434 | - events.add(IntentEvent.getEvent(SUBMITTED, intent)); | 434 | + events.add(IntentEvent.getEvent(INSTALL_REQ, intent)); |
435 | break; | 435 | break; |
436 | 436 | ||
437 | case REMOVE_INTENT: | 437 | case REMOVE_INTENT: | ... | ... |
... | @@ -72,12 +72,12 @@ public class HazelcastIntentStore | ... | @@ -72,12 +72,12 @@ public class HazelcastIntentStore |
72 | implements IntentStore, MetricsHelper { | 72 | implements IntentStore, MetricsHelper { |
73 | 73 | ||
74 | /** Valid parking state, which can transition to INSTALLED. */ | 74 | /** Valid parking state, which can transition to INSTALLED. */ |
75 | - private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(SUBMITTED, INSTALLED, FAILED); | 75 | + private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(INSTALL_REQ, INSTALLED, FAILED); |
76 | 76 | ||
77 | /** Valid parking state, which can transition to WITHDRAWN. */ | 77 | /** Valid parking state, which can transition to WITHDRAWN. */ |
78 | private static final Set<IntentState> PRE_WITHDRAWN = EnumSet.of(INSTALLED, FAILED); | 78 | private static final Set<IntentState> PRE_WITHDRAWN = EnumSet.of(INSTALLED, FAILED); |
79 | 79 | ||
80 | - private static final Set<IntentState> PARKING = EnumSet.of(SUBMITTED, INSTALLED, WITHDRAWN, FAILED); | 80 | + private static final Set<IntentState> PARKING = EnumSet.of(INSTALL_REQ, INSTALLED, WITHDRAWN, FAILED); |
81 | 81 | ||
82 | private final Logger log = getLogger(getClass()); | 82 | private final Logger log = getLogger(getClass()); |
83 | 83 | ||
... | @@ -150,7 +150,7 @@ public class HazelcastIntentStore | ... | @@ -150,7 +150,7 @@ public class HazelcastIntentStore |
150 | IMap<byte[], byte[]> rawStates = super.theInstance.getMap("intent-states"); | 150 | IMap<byte[], byte[]> rawStates = super.theInstance.getMap("intent-states"); |
151 | states = new SMap<>(rawStates , super.serializer); | 151 | states = new SMap<>(rawStates , super.serializer); |
152 | EntryListener<IntentId, IntentState> listener = new RemoteIntentStateListener(); | 152 | EntryListener<IntentId, IntentState> listener = new RemoteIntentStateListener(); |
153 | - states.addEntryListener(listener , false); | 153 | + states.addEntryListener(listener , true); |
154 | 154 | ||
155 | transientStates.clear(); | 155 | transientStates.clear(); |
156 | 156 | ||
... | @@ -180,7 +180,7 @@ public class HazelcastIntentStore | ... | @@ -180,7 +180,7 @@ public class HazelcastIntentStore |
180 | // duplicate, ignore | 180 | // duplicate, ignore |
181 | return; | 181 | return; |
182 | } else { | 182 | } else { |
183 | - this.setState(intent, IntentState.SUBMITTED); | 183 | + this.setState(intent, IntentState.INSTALL_REQ); |
184 | return; | 184 | return; |
185 | } | 185 | } |
186 | } finally { | 186 | } finally { |
... | @@ -261,7 +261,6 @@ public class HazelcastIntentStore | ... | @@ -261,7 +261,6 @@ public class HazelcastIntentStore |
261 | public void setState(Intent intent, IntentState state) { | 261 | public void setState(Intent intent, IntentState state) { |
262 | Context timer = startTimer(setStateTimer); | 262 | Context timer = startTimer(setStateTimer); |
263 | try { | 263 | try { |
264 | - | ||
265 | final IntentId id = intent.id(); | 264 | final IntentId id = intent.id(); |
266 | IntentEvent.Type type = null; | 265 | IntentEvent.Type type = null; |
267 | final IntentState prevParking; | 266 | final IntentState prevParking; |
... | @@ -269,23 +268,23 @@ public class HazelcastIntentStore | ... | @@ -269,23 +268,23 @@ public class HazelcastIntentStore |
269 | 268 | ||
270 | // parking state transition | 269 | // parking state transition |
271 | switch (state) { | 270 | switch (state) { |
272 | - case SUBMITTED: | 271 | + case INSTALL_REQ: |
273 | prevParking = states.get(id); | 272 | prevParking = states.get(id); |
274 | if (prevParking == null) { | 273 | if (prevParking == null) { |
275 | - IntentState existing = states.putIfAbsent(id, SUBMITTED); | 274 | + IntentState existing = states.putIfAbsent(id, INSTALL_REQ); |
276 | - verify(existing == null, "Conditional replace %s => %s failed", prevParking, SUBMITTED); | 275 | + verify(existing == null, "Conditional replace %s => %s failed", prevParking, INSTALL_REQ); |
277 | } else { | 276 | } else { |
278 | - verify(prevParking == WITHDRAWN, | 277 | + verify(PRE_INSTALLED.contains(prevParking), |
279 | - "Illegal state transition attempted from %s to SUBMITTED", | 278 | + "Illegal state transition attempted from %s to INSTALL_REQ", |
280 | prevParking); | 279 | prevParking); |
281 | - boolean updated = states.replace(id, prevParking, SUBMITTED); | 280 | + boolean updated = states.replace(id, prevParking, INSTALL_REQ); |
282 | - verify(updated, "Conditional replace %s => %s failed", prevParking, SUBMITTED); | 281 | + verify(updated, "Conditional replace %s => %s failed", prevParking, INSTALL_REQ); |
283 | } | 282 | } |
284 | - type = IntentEvent.Type.SUBMITTED; | 283 | + type = IntentEvent.Type.INSTALL_REQ; |
285 | break; | 284 | break; |
286 | case INSTALLED: | 285 | case INSTALLED: |
287 | prevParking = states.replace(id, INSTALLED); | 286 | prevParking = states.replace(id, INSTALLED); |
288 | - verify(PRE_INSTALLED.contains(prevParking), | 287 | + verify(prevParking == INSTALL_REQ, |
289 | "Illegal state transition attempted from %s to INSTALLED", | 288 | "Illegal state transition attempted from %s to INSTALLED", |
290 | prevParking); | 289 | prevParking); |
291 | type = IntentEvent.Type.INSTALLED; | 290 | type = IntentEvent.Type.INSTALLED; |
... | @@ -294,9 +293,16 @@ public class HazelcastIntentStore | ... | @@ -294,9 +293,16 @@ public class HazelcastIntentStore |
294 | prevParking = states.replace(id, FAILED); | 293 | prevParking = states.replace(id, FAILED); |
295 | type = IntentEvent.Type.FAILED; | 294 | type = IntentEvent.Type.FAILED; |
296 | break; | 295 | break; |
296 | + case WITHDRAW_REQ: | ||
297 | + prevParking = states.replace(id, WITHDRAW_REQ); | ||
298 | + verify(PRE_WITHDRAWN.contains(prevParking), | ||
299 | + "Illegal state transition attempted from %s to WITHDRAW_REQ", | ||
300 | + prevParking); | ||
301 | + type = IntentEvent.Type.WITHDRAW_REQ; | ||
302 | + break; | ||
297 | case WITHDRAWN: | 303 | case WITHDRAWN: |
298 | prevParking = states.replace(id, WITHDRAWN); | 304 | prevParking = states.replace(id, WITHDRAWN); |
299 | - verify(PRE_WITHDRAWN.contains(prevParking), | 305 | + verify(prevParking == WITHDRAW_REQ, |
300 | "Illegal state transition attempted from %s to WITHDRAWN", | 306 | "Illegal state transition attempted from %s to WITHDRAWN", |
301 | prevParking); | 307 | prevParking); |
302 | type = IntentEvent.Type.WITHDRAWN; | 308 | type = IntentEvent.Type.WITHDRAWN; |
... | @@ -316,7 +322,6 @@ public class HazelcastIntentStore | ... | @@ -316,7 +322,6 @@ public class HazelcastIntentStore |
316 | if (type != null) { | 322 | if (type != null) { |
317 | notifyDelegate(new IntentEvent(type, intent)); | 323 | notifyDelegate(new IntentEvent(type, intent)); |
318 | } | 324 | } |
319 | - return; | ||
320 | } finally { | 325 | } finally { |
321 | stopTimer(timer); | 326 | stopTimer(timer); |
322 | } | 327 | } |
... | @@ -370,7 +375,7 @@ public class HazelcastIntentStore | ... | @@ -370,7 +375,7 @@ public class HazelcastIntentStore |
370 | Intent intent = op.arg(0); | 375 | Intent intent = op.arg(0); |
371 | futures.add(Pair.of(op, | 376 | futures.add(Pair.of(op, |
372 | ImmutableList.of(intents.putAsync(intent.id(), intent), | 377 | ImmutableList.of(intents.putAsync(intent.id(), intent), |
373 | - states.putAsync(intent.id(), SUBMITTED)))); | 378 | + states.putAsync(intent.id(), INSTALL_REQ)))); |
374 | break; | 379 | break; |
375 | 380 | ||
376 | case REMOVE_INTENT: | 381 | case REMOVE_INTENT: |
... | @@ -426,7 +431,7 @@ public class HazelcastIntentStore | ... | @@ -426,7 +431,7 @@ public class HazelcastIntentStore |
426 | case CREATE_INTENT: | 431 | case CREATE_INTENT: |
427 | { | 432 | { |
428 | Intent intent = op.arg(0); | 433 | Intent intent = op.arg(0); |
429 | - IntentState newIntentState = SUBMITTED; | 434 | + IntentState newIntentState = INSTALL_REQ; |
430 | 435 | ||
431 | try { | 436 | try { |
432 | Intent prevIntent = (Intent) subops.get(0).get(); | 437 | Intent prevIntent = (Intent) subops.get(0).get(); |
... | @@ -437,7 +442,7 @@ public class HazelcastIntentStore | ... | @@ -437,7 +442,7 @@ public class HazelcastIntentStore |
437 | prevIntent, prevIntentState, | 442 | prevIntent, prevIntentState, |
438 | intent, newIntentState); | 443 | intent, newIntentState); |
439 | } | 444 | } |
440 | - events.add(IntentEvent.getEvent(SUBMITTED, intent)); | 445 | + events.add(IntentEvent.getEvent(INSTALL_REQ, intent)); |
441 | } catch (InterruptedException e) { | 446 | } catch (InterruptedException e) { |
442 | log.error("Batch write was interrupted while processing {}", op, e); | 447 | log.error("Batch write was interrupted while processing {}", op, e); |
443 | failed.add(op); | 448 | failed.add(op); | ... | ... |
... | @@ -31,7 +31,7 @@ import java.util.concurrent.atomic.AtomicLong; | ... | @@ -31,7 +31,7 @@ import java.util.concurrent.atomic.AtomicLong; |
31 | @Service | 31 | @Service |
32 | public class SimpleIdBlockStore implements IdBlockStore { | 32 | public class SimpleIdBlockStore implements IdBlockStore { |
33 | 33 | ||
34 | - private static final long DEFAULT_BLOCK_SIZE = 1000L; | 34 | + private static final long DEFAULT_BLOCK_SIZE = 0x1000L; |
35 | 35 | ||
36 | private final Map<String, AtomicLong> topicBlocks = new ConcurrentHashMap<>(); | 36 | private final Map<String, AtomicLong> topicBlocks = new ConcurrentHashMap<>(); |
37 | 37 | ... | ... |
... | @@ -69,8 +69,7 @@ public class SimpleIntentStore | ... | @@ -69,8 +69,7 @@ public class SimpleIntentStore |
69 | return; | 69 | return; |
70 | } | 70 | } |
71 | intents.put(intent.id(), intent); | 71 | intents.put(intent.id(), intent); |
72 | - this.setState(intent, IntentState.SUBMITTED); | 72 | + this.setState(intent, IntentState.INSTALL_REQ); |
73 | - return; | ||
74 | } | 73 | } |
75 | 74 | ||
76 | @Override | 75 | @Override |
... | @@ -109,8 +108,8 @@ public class SimpleIntentStore | ... | @@ -109,8 +108,8 @@ public class SimpleIntentStore |
109 | IntentEvent.Type type = null; | 108 | IntentEvent.Type type = null; |
110 | 109 | ||
111 | switch (state) { | 110 | switch (state) { |
112 | - case SUBMITTED: | 111 | + case INSTALL_REQ: |
113 | - type = IntentEvent.Type.SUBMITTED; | 112 | + type = IntentEvent.Type.INSTALL_REQ; |
114 | break; | 113 | break; |
115 | case INSTALLED: | 114 | case INSTALLED: |
116 | type = IntentEvent.Type.INSTALLED; | 115 | type = IntentEvent.Type.INSTALLED; |
... | @@ -118,6 +117,9 @@ public class SimpleIntentStore | ... | @@ -118,6 +117,9 @@ public class SimpleIntentStore |
118 | case FAILED: | 117 | case FAILED: |
119 | type = IntentEvent.Type.FAILED; | 118 | type = IntentEvent.Type.FAILED; |
120 | break; | 119 | break; |
120 | + case WITHDRAW_REQ: | ||
121 | + type = IntentEvent.Type.WITHDRAW_REQ; | ||
122 | + break; | ||
121 | case WITHDRAWN: | 123 | case WITHDRAWN: |
122 | type = IntentEvent.Type.WITHDRAWN; | 124 | type = IntentEvent.Type.WITHDRAWN; |
123 | break; | 125 | break; | ... | ... |
... | @@ -59,6 +59,7 @@ public class SimpleLeadershipManager implements LeadershipService { | ... | @@ -59,6 +59,7 @@ public class SimpleLeadershipManager implements LeadershipService { |
59 | 59 | ||
60 | @Override | 60 | @Override |
61 | public Map<String, Leadership> getLeaderBoard() { | 61 | public Map<String, Leadership> getLeaderBoard() { |
62 | + //FIXME | ||
62 | throw new UnsupportedOperationException("I don't know what to do." + | 63 | throw new UnsupportedOperationException("I don't know what to do." + |
63 | " I wish you luck."); | 64 | " I wish you luck."); |
64 | } | 65 | } | ... | ... |
-
Please register or login to post a comment