mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-11-06 03:01:35 +01:00
Merge branch 'master' of ssh://gerrit.onlab.us:29418/onos-next
This commit is contained in:
commit
01fbcdf626
@ -1,12 +1,9 @@
|
|||||||
package org.onlab.onos.cluster;
|
package org.onlab.onos.cluster;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A container for detailed role information for a device,
|
* A container for detailed role information for a device,
|
||||||
* within the current cluster. Role attributes include current
|
* within the current cluster. Role attributes include current
|
||||||
@ -18,9 +15,7 @@ public class RoleInfo {
|
|||||||
|
|
||||||
public RoleInfo(NodeId master, List<NodeId> backups) {
|
public RoleInfo(NodeId master, List<NodeId> backups) {
|
||||||
this.master = master;
|
this.master = master;
|
||||||
this.backups = new LinkedList<>();
|
this.backups = Collections.unmodifiableList(backups);
|
||||||
|
|
||||||
this.backups.addAll(checkNotNull(backups));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NodeId master() {
|
public NodeId master() {
|
||||||
@ -28,7 +23,7 @@ public class RoleInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<NodeId> backups() {
|
public List<NodeId> backups() {
|
||||||
return Collections.unmodifiableList(backups);
|
return backups;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -57,10 +52,10 @@ public class RoleInfo {
|
|||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
builder.append("master: \n\t").append(master).append("\n");
|
builder.append("master:").append(master).append(",");
|
||||||
builder.append("backups: \n");
|
builder.append("backups:");
|
||||||
for (NodeId n : backups) {
|
for (NodeId n : backups) {
|
||||||
builder.append("\t").append(n).append("\n");
|
builder.append(" ").append(n);
|
||||||
}
|
}
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user