
org.wildfly.clustering.singleton.server.SingletonElectionCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wildfly-clustering-singleton-server Show documentation
Show all versions of wildfly-clustering-singleton-server Show documentation
Contains implementations of the clustering singleton services.
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.wildfly.clustering.singleton.server;
import java.util.List;
import org.wildfly.clustering.server.GroupMember;
import org.wildfly.clustering.server.dispatcher.Command;
import org.wildfly.clustering.singleton.election.SingletonElectionListener;
/**
* @author Paul Ferraro
*/
public class SingletonElectionCommand implements Command {
private final List candidates;
private final Integer index;
public SingletonElectionCommand(List candidates, GroupMember elected) {
this(candidates, (elected != null) ? candidates.indexOf(elected) : null);
}
SingletonElectionCommand(List candidates, Integer index) {
this.candidates = candidates;
this.index = index;
}
List getCandidates() {
return this.candidates;
}
Integer getIndex() {
return this.index;
}
@Override
public Void execute(SingletonElectionListener context) {
context.elected(this.candidates, (this.index != null) ? this.candidates.get(this.index) : null);
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy