Search in sources :

Example 1 with LeadershipAdminService

use of org.onosproject.cluster.LeadershipAdminService in project onos by opennetworkinglab.

the class LeaderCommand method doExecute.

@Override
protected void doExecute() {
    LeadershipAdminService leaderService = get(LeadershipAdminService.class);
    Map<String, Leadership> leaderBoard = leaderService.getLeaderBoard();
    if (topicPattern == null) {
        allTopics = true;
    } else {
        allTopics = false;
        pattern = Pattern.compile(topicPattern);
    }
    if (outputJson()) {
        print("%s", json(leaderBoard));
        return;
    }
    if (showCandidates) {
        displayCandidates(leaderBoard);
    } else {
        displayLeaders(leaderBoard);
    }
}
Also used : Leadership(org.onosproject.cluster.Leadership) LeadershipAdminService(org.onosproject.cluster.LeadershipAdminService)

Aggregations

Leadership (org.onosproject.cluster.Leadership)1 LeadershipAdminService (org.onosproject.cluster.LeadershipAdminService)1