mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-11-02 17:21:05 +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;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* A container for detailed role information for a device,
|
||||
* within the current cluster. Role attributes include current
|
||||
@ -18,9 +15,7 @@ public class RoleInfo {
|
||||
|
||||
public RoleInfo(NodeId master, List<NodeId> backups) {
|
||||
this.master = master;
|
||||
this.backups = new LinkedList<>();
|
||||
|
||||
this.backups.addAll(checkNotNull(backups));
|
||||
this.backups = Collections.unmodifiableList(backups);
|
||||
}
|
||||
|
||||
public NodeId master() {
|
||||
@ -28,7 +23,7 @@ public class RoleInfo {
|
||||
}
|
||||
|
||||
public List<NodeId> backups() {
|
||||
return Collections.unmodifiableList(backups);
|
||||
return backups;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -57,10 +52,10 @@ public class RoleInfo {
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
builder.append("master: \n\t").append(master).append("\n");
|
||||
builder.append("backups: \n");
|
||||
builder.append("master:").append(master).append(",");
|
||||
builder.append("backups:");
|
||||
for (NodeId n : backups) {
|
||||
builder.append("\t").append(n).append("\n");
|
||||
builder.append(" ").append(n);
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user