Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Thomas Vachuska
2014-10-23 16:17:03 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8ac922dad8de7bd5d211725fc0cd649b2138165d
8ac922da
1 parent
34d76aef
FIxed checkstyle fails.
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
33 deletions
core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java
core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleFlowRuleStore.java
core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java
View file @
8ac922d
...
...
@@ -76,7 +76,8 @@ public class FlowRuleManager
private
final
FlowRuleStoreDelegate
delegate
=
new
InternalStoreDelegate
();
private
final
ExecutorService
futureListeners
=
Executors
.
newCachedThreadPool
(
namedThreads
(
"provider-future-listeners"
));
private
final
ExecutorService
futureListeners
=
Executors
.
newCachedThreadPool
(
namedThreads
(
"provider-future-listeners"
));
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
protected
FlowRuleStore
store
;
...
...
@@ -404,7 +405,8 @@ public class FlowRuleManager
result
.
addListener
(
new
Runnable
()
{
@Override
public
void
run
()
{
store
.
batchOperationComplete
(
FlowRuleBatchEvent
.
completed
(
request
,
Futures
.
getUnchecked
(
result
)));
store
.
batchOperationComplete
(
FlowRuleBatchEvent
.
completed
(
request
,
Futures
.
getUnchecked
(
result
)));
}
},
futureListeners
);
...
...
core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleFlowRuleStore.java
View file @
8ac922d
package
org
.
onlab
.
onos
.
store
.
trivial
.
impl
;
import
static
org
.
onlab
.
onos
.
net
.
flow
.
FlowRuleEvent
.
Type
.
RULE_REMOVED
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
static
org
.
apache
.
commons
.
lang3
.
concurrent
.
ConcurrentUtils
.
createIfAbsentUnchecked
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
import
java.util.concurrent.CopyOnWriteArrayList
;
import
java.util.concurrent.Future
;
import
com.google.common.base.Function
;
import
com.google.common.collect.FluentIterable
;
import
com.google.common.util.concurrent.Futures
;
import
org.apache.felix.scr.annotations.Activate
;
import
org.apache.felix.scr.annotations.Component
;
import
org.apache.felix.scr.annotations.Deactivate
;
...
...
@@ -40,9 +29,19 @@ import org.onlab.onos.store.AbstractStore;
import
org.onlab.util.NewConcurrentHashMap
;
import
org.slf4j.Logger
;
import
com.google.common.base.Function
;
import
com.google.common.collect.FluentIterable
;
import
com.google.common.util.concurrent.Futures
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
import
java.util.concurrent.CopyOnWriteArrayList
;
import
java.util.concurrent.Future
;
import
static
org
.
apache
.
commons
.
lang3
.
concurrent
.
ConcurrentUtils
.
createIfAbsentUnchecked
;
import
static
org
.
onlab
.
onos
.
net
.
flow
.
FlowRuleEvent
.
Type
.
RULE_REMOVED
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
/**
* Manages inventory of flow rules using trivial in-memory implementation.
...
...
@@ -132,15 +131,15 @@ public class SimpleFlowRuleStore
public
Iterable
<
FlowEntry
>
getFlowEntries
(
DeviceId
deviceId
)
{
// flatten and make iterator unmodifiable
return
FluentIterable
.
from
(
getFlowTable
(
deviceId
).
values
())
.
transformAndConcat
(
new
Function
<
List
<
StoredFlowEntry
>,
Iterable
<?
extends
FlowEntry
>>()
{
@Override
public
Iterable
<?
extends
FlowEntry
>
apply
(
List
<
StoredFlowEntry
>
input
)
{
return
Collections
.
unmodifiableList
(
input
);
}
});
.
transformAndConcat
(
new
Function
<
List
<
StoredFlowEntry
>,
Iterable
<?
extends
FlowEntry
>>()
{
@Override
public
Iterable
<?
extends
FlowEntry
>
apply
(
List
<
StoredFlowEntry
>
input
)
{
return
Collections
.
unmodifiableList
(
input
);
}
});
}
@Override
...
...
@@ -177,9 +176,9 @@ public class SimpleFlowRuleStore
// new flow rule added
existing
.
add
(
f
);
notifyDelegate
(
FlowRuleBatchEvent
.
requested
(
new
FlowRuleBatchRequest
(
1
,
/* FIXME generate something */
Arrays
.<
FlowEntry
>
asList
(
f
),
Collections
.<
FlowEntry
>
emptyList
())));
new
FlowRuleBatchRequest
(
1
,
/* FIXME generate something */
Arrays
.<
FlowEntry
>
asList
(
f
),
Collections
.<
FlowEntry
>
emptyList
())));
}
}
...
...
@@ -196,8 +195,8 @@ public class SimpleFlowRuleStore
// TODO: Should we notify only if it's "remote" event?
notifyDelegate
(
FlowRuleBatchEvent
.
requested
(
new
FlowRuleBatchRequest
(
1
,
/* FIXME generate something */
Collections
.<
FlowEntry
>
emptyList
(),
Arrays
.<
FlowEntry
>
asList
(
entry
))));
Collections
.<
FlowEntry
>
emptyList
(),
Arrays
.<
FlowEntry
>
asList
(
entry
))));
}
}
}
...
...
Please
register
or
login
to post a comment