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
Yuta HIGUCHI
2014-10-23 12:09:43 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
868def0f97607b7e1e4905b2410faa3794e06cc3
868def0f
1 parent
87102541
minor changes to RoleValue
Change-Id: Id870843c53549439e88ada40e8b2ef5513b8e4b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
core/store/hz/cluster/src/main/java/org/onlab/onos/store/mastership/impl/RoleValue.java
core/store/hz/cluster/src/main/java/org/onlab/onos/store/mastership/impl/RoleValueSerializer.java
core/store/hz/cluster/src/main/java/org/onlab/onos/store/mastership/impl/RoleValue.java
View file @
868def0
package
org
.
onlab
.
onos
.
store
.
mastership
.
impl
;
import
java.util.Collections
;
import
java.util.
Hash
Map
;
import
java.util.
Enum
Map
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -17,9 +17,9 @@ import com.google.common.base.MoreObjects.ToStringHelper;
* A structure that holds node mastership roles associated with a
* {@link DeviceId}. This structure needs to be locked through IMap.
*/
public
class
RoleValue
{
final
class
RoleValue
{
protected
Map
<
MastershipRole
,
List
<
NodeId
>>
value
=
new
HashMap
<>(
);
protected
final
Map
<
MastershipRole
,
List
<
NodeId
>>
value
=
new
EnumMap
<>(
MastershipRole
.
class
);
public
RoleValue
()
{
value
.
put
(
MastershipRole
.
MASTER
,
new
LinkedList
<
NodeId
>());
...
...
@@ -27,7 +27,8 @@ public class RoleValue {
value
.
put
(
MastershipRole
.
NONE
,
new
LinkedList
<
NodeId
>());
}
public
Map
<
MastershipRole
,
List
<
NodeId
>>
value
()
{
// exposing internals for serialization purpose only
Map
<
MastershipRole
,
List
<
NodeId
>>
value
()
{
return
Collections
.
unmodifiableMap
(
value
);
}
...
...
core/store/hz/cluster/src/main/java/org/onlab/onos/store/mastership/impl/RoleValueSerializer.java
View file @
868def0
...
...
@@ -35,10 +35,10 @@ public class RoleValueSerializer extends Serializer<RoleValue> {
@Override
public
void
write
(
Kryo
kryo
,
Output
output
,
RoleValue
type
)
{
output
.
writeInt
(
type
.
value
().
size
());
final
Map
<
MastershipRole
,
List
<
NodeId
>>
map
=
type
.
value
();
output
.
writeInt
(
map
.
size
());
for
(
Map
.
Entry
<
MastershipRole
,
List
<
NodeId
>>
el
:
type
.
value
().
entrySet
())
{
for
(
Map
.
Entry
<
MastershipRole
,
List
<
NodeId
>>
el
:
map
.
entrySet
())
{
output
.
writeInt
(
el
.
getKey
().
ordinal
());
List
<
NodeId
>
nodes
=
el
.
getValue
();
...
...
Please
register
or
login
to post a comment