dispatching failed event when compile fails
Change-Id: I5c5ae38c25a8ef08bc066bcf5bc70bc85137934d
Showing
1 changed file
with
29 additions
and
22 deletions
1 | package org.onlab.onos.net.intent.impl; | 1 | package org.onlab.onos.net.intent.impl; |
2 | 2 | ||
3 | -import com.google.common.collect.ImmutableList; | 3 | +import static com.google.common.base.Preconditions.checkNotNull; |
4 | -import com.google.common.collect.ImmutableMap; | 4 | +import static java.util.concurrent.Executors.newSingleThreadExecutor; |
5 | -import com.google.common.collect.Lists; | 5 | +import static org.onlab.onos.net.intent.IntentState.COMPILING; |
6 | +import static org.onlab.onos.net.intent.IntentState.FAILED; | ||
7 | +import static org.onlab.onos.net.intent.IntentState.INSTALLED; | ||
8 | +import static org.onlab.onos.net.intent.IntentState.INSTALLING; | ||
9 | +import static org.onlab.onos.net.intent.IntentState.RECOMPILING; | ||
10 | +import static org.onlab.onos.net.intent.IntentState.WITHDRAWING; | ||
11 | +import static org.onlab.onos.net.intent.IntentState.WITHDRAWN; | ||
12 | +import static org.onlab.util.Tools.namedThreads; | ||
13 | +import static org.slf4j.LoggerFactory.getLogger; | ||
14 | + | ||
15 | +import java.util.ArrayList; | ||
16 | +import java.util.Iterator; | ||
17 | +import java.util.List; | ||
18 | +import java.util.Map; | ||
19 | +import java.util.Objects; | ||
20 | +import java.util.concurrent.ConcurrentHashMap; | ||
21 | +import java.util.concurrent.ConcurrentMap; | ||
22 | +import java.util.concurrent.ExecutionException; | ||
23 | +import java.util.concurrent.ExecutorService; | ||
24 | +import java.util.concurrent.Future; | ||
25 | +import java.util.concurrent.TimeUnit; | ||
26 | +import java.util.concurrent.TimeoutException; | ||
27 | + | ||
6 | import org.apache.felix.scr.annotations.Activate; | 28 | import org.apache.felix.scr.annotations.Activate; |
7 | import org.apache.felix.scr.annotations.Component; | 29 | import org.apache.felix.scr.annotations.Component; |
8 | import org.apache.felix.scr.annotations.Deactivate; | 30 | import org.apache.felix.scr.annotations.Deactivate; |
... | @@ -29,24 +51,9 @@ import org.onlab.onos.net.intent.IntentStore; | ... | @@ -29,24 +51,9 @@ import org.onlab.onos.net.intent.IntentStore; |
29 | import org.onlab.onos.net.intent.IntentStoreDelegate; | 51 | import org.onlab.onos.net.intent.IntentStoreDelegate; |
30 | import org.slf4j.Logger; | 52 | import org.slf4j.Logger; |
31 | 53 | ||
32 | -import java.util.ArrayList; | 54 | +import com.google.common.collect.ImmutableList; |
33 | -import java.util.Iterator; | 55 | +import com.google.common.collect.ImmutableMap; |
34 | -import java.util.List; | 56 | +import com.google.common.collect.Lists; |
35 | -import java.util.Map; | ||
36 | -import java.util.Objects; | ||
37 | -import java.util.concurrent.ConcurrentHashMap; | ||
38 | -import java.util.concurrent.ConcurrentMap; | ||
39 | -import java.util.concurrent.ExecutionException; | ||
40 | -import java.util.concurrent.ExecutorService; | ||
41 | -import java.util.concurrent.Future; | ||
42 | -import java.util.concurrent.TimeUnit; | ||
43 | -import java.util.concurrent.TimeoutException; | ||
44 | - | ||
45 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
46 | -import static java.util.concurrent.Executors.newSingleThreadExecutor; | ||
47 | -import static org.onlab.onos.net.intent.IntentState.*; | ||
48 | -import static org.onlab.util.Tools.namedThreads; | ||
49 | -import static org.slf4j.LoggerFactory.getLogger; | ||
50 | 57 | ||
51 | /** | 58 | /** |
52 | * An implementation of Intent Manager. | 59 | * An implementation of Intent Manager. |
... | @@ -258,7 +265,7 @@ public class IntentManager | ... | @@ -258,7 +265,7 @@ public class IntentManager |
258 | log.warn("Unable to compile intent {} due to:", intent.id(), e); | 265 | log.warn("Unable to compile intent {} due to:", intent.id(), e); |
259 | 266 | ||
260 | // If compilation failed, mark the intent as failed. | 267 | // If compilation failed, mark the intent as failed. |
261 | - store.setState(intent, FAILED); | 268 | + eventDispatcher.post(store.setState(intent, FAILED)); |
262 | } | 269 | } |
263 | } | 270 | } |
264 | 271 | ... | ... |
-
Please register or login to post a comment