Showing
2 changed files
with
34 additions
and
33 deletions
... | @@ -76,7 +76,8 @@ public class FlowRuleManager | ... | @@ -76,7 +76,8 @@ public class FlowRuleManager |
76 | 76 | ||
77 | private final FlowRuleStoreDelegate delegate = new InternalStoreDelegate(); | 77 | private final FlowRuleStoreDelegate delegate = new InternalStoreDelegate(); |
78 | 78 | ||
79 | - private final ExecutorService futureListeners = Executors.newCachedThreadPool(namedThreads("provider-future-listeners")); | 79 | + private final ExecutorService futureListeners = |
80 | + Executors.newCachedThreadPool(namedThreads("provider-future-listeners")); | ||
80 | 81 | ||
81 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 82 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
82 | protected FlowRuleStore store; | 83 | protected FlowRuleStore store; |
... | @@ -404,7 +405,8 @@ public class FlowRuleManager | ... | @@ -404,7 +405,8 @@ public class FlowRuleManager |
404 | result.addListener(new Runnable() { | 405 | result.addListener(new Runnable() { |
405 | @Override | 406 | @Override |
406 | public void run() { | 407 | public void run() { |
407 | - store.batchOperationComplete(FlowRuleBatchEvent.completed(request, Futures.getUnchecked(result))); | 408 | + store.batchOperationComplete(FlowRuleBatchEvent.completed(request, |
409 | + Futures.getUnchecked(result))); | ||
408 | } | 410 | } |
409 | }, futureListeners); | 411 | }, futureListeners); |
410 | 412 | ... | ... |
1 | package org.onlab.onos.store.trivial.impl; | 1 | package org.onlab.onos.store.trivial.impl; |
2 | 2 | ||
3 | -import static org.onlab.onos.net.flow.FlowRuleEvent.Type.RULE_REMOVED; | 3 | +import com.google.common.base.Function; |
4 | -import static org.slf4j.LoggerFactory.getLogger; | 4 | +import com.google.common.collect.FluentIterable; |
5 | -import static org.apache.commons.lang3.concurrent.ConcurrentUtils.createIfAbsentUnchecked; | 5 | +import com.google.common.util.concurrent.Futures; |
6 | - | ||
7 | -import java.util.Arrays; | ||
8 | -import java.util.Collections; | ||
9 | -import java.util.HashSet; | ||
10 | -import java.util.List; | ||
11 | -import java.util.Set; | ||
12 | -import java.util.concurrent.ConcurrentHashMap; | ||
13 | -import java.util.concurrent.ConcurrentMap; | ||
14 | -import java.util.concurrent.CopyOnWriteArrayList; | ||
15 | -import java.util.concurrent.Future; | ||
16 | - | ||
17 | import org.apache.felix.scr.annotations.Activate; | 6 | import org.apache.felix.scr.annotations.Activate; |
18 | import org.apache.felix.scr.annotations.Component; | 7 | import org.apache.felix.scr.annotations.Component; |
19 | import org.apache.felix.scr.annotations.Deactivate; | 8 | import org.apache.felix.scr.annotations.Deactivate; |
... | @@ -40,9 +29,19 @@ import org.onlab.onos.store.AbstractStore; | ... | @@ -40,9 +29,19 @@ import org.onlab.onos.store.AbstractStore; |
40 | import org.onlab.util.NewConcurrentHashMap; | 29 | import org.onlab.util.NewConcurrentHashMap; |
41 | import org.slf4j.Logger; | 30 | import org.slf4j.Logger; |
42 | 31 | ||
43 | -import com.google.common.base.Function; | 32 | +import java.util.Arrays; |
44 | -import com.google.common.collect.FluentIterable; | 33 | +import java.util.Collections; |
45 | -import com.google.common.util.concurrent.Futures; | 34 | +import java.util.HashSet; |
35 | +import java.util.List; | ||
36 | +import java.util.Set; | ||
37 | +import java.util.concurrent.ConcurrentHashMap; | ||
38 | +import java.util.concurrent.ConcurrentMap; | ||
39 | +import java.util.concurrent.CopyOnWriteArrayList; | ||
40 | +import java.util.concurrent.Future; | ||
41 | + | ||
42 | +import static org.apache.commons.lang3.concurrent.ConcurrentUtils.createIfAbsentUnchecked; | ||
43 | +import static org.onlab.onos.net.flow.FlowRuleEvent.Type.RULE_REMOVED; | ||
44 | +import static org.slf4j.LoggerFactory.getLogger; | ||
46 | 45 | ||
47 | /** | 46 | /** |
48 | * Manages inventory of flow rules using trivial in-memory implementation. | 47 | * Manages inventory of flow rules using trivial in-memory implementation. |
... | @@ -132,15 +131,15 @@ public class SimpleFlowRuleStore | ... | @@ -132,15 +131,15 @@ public class SimpleFlowRuleStore |
132 | public Iterable<FlowEntry> getFlowEntries(DeviceId deviceId) { | 131 | public Iterable<FlowEntry> getFlowEntries(DeviceId deviceId) { |
133 | // flatten and make iterator unmodifiable | 132 | // flatten and make iterator unmodifiable |
134 | return FluentIterable.from(getFlowTable(deviceId).values()) | 133 | return FluentIterable.from(getFlowTable(deviceId).values()) |
135 | - .transformAndConcat( | 134 | + .transformAndConcat( |
136 | - new Function<List<StoredFlowEntry>, Iterable<? extends FlowEntry>>() { | 135 | + new Function<List<StoredFlowEntry>, Iterable<? extends FlowEntry>>() { |
137 | - | 136 | + |
138 | - @Override | 137 | + @Override |
139 | - public Iterable<? extends FlowEntry> apply( | 138 | + public Iterable<? extends FlowEntry> apply( |
140 | - List<StoredFlowEntry> input) { | 139 | + List<StoredFlowEntry> input) { |
141 | - return Collections.unmodifiableList(input); | 140 | + return Collections.unmodifiableList(input); |
142 | - } | 141 | + } |
143 | - }); | 142 | + }); |
144 | } | 143 | } |
145 | 144 | ||
146 | @Override | 145 | @Override |
... | @@ -177,9 +176,9 @@ public class SimpleFlowRuleStore | ... | @@ -177,9 +176,9 @@ public class SimpleFlowRuleStore |
177 | // new flow rule added | 176 | // new flow rule added |
178 | existing.add(f); | 177 | existing.add(f); |
179 | notifyDelegate(FlowRuleBatchEvent.requested( | 178 | notifyDelegate(FlowRuleBatchEvent.requested( |
180 | - new FlowRuleBatchRequest( 1, /* FIXME generate something */ | 179 | + new FlowRuleBatchRequest(1, /* FIXME generate something */ |
181 | - Arrays.<FlowEntry>asList(f), | 180 | + Arrays.<FlowEntry>asList(f), |
182 | - Collections.<FlowEntry>emptyList()))); | 181 | + Collections.<FlowEntry>emptyList()))); |
183 | } | 182 | } |
184 | } | 183 | } |
185 | 184 | ||
... | @@ -196,8 +195,8 @@ public class SimpleFlowRuleStore | ... | @@ -196,8 +195,8 @@ public class SimpleFlowRuleStore |
196 | // TODO: Should we notify only if it's "remote" event? | 195 | // TODO: Should we notify only if it's "remote" event? |
197 | notifyDelegate(FlowRuleBatchEvent.requested( | 196 | notifyDelegate(FlowRuleBatchEvent.requested( |
198 | new FlowRuleBatchRequest(1, /* FIXME generate something */ | 197 | new FlowRuleBatchRequest(1, /* FIXME generate something */ |
199 | - Collections.<FlowEntry>emptyList(), | 198 | + Collections.<FlowEntry>emptyList(), |
200 | - Arrays.<FlowEntry>asList(entry)))); | 199 | + Arrays.<FlowEntry>asList(entry)))); |
201 | } | 200 | } |
202 | } | 201 | } |
203 | } | 202 | } | ... | ... |
-
Please register or login to post a comment