38 lines
1.5 KiB
Java
38 lines
1.5 KiB
Java
package meerkat.voting.controller.callbacks;
|
|
|
|
import meerkat.protobuf.Voting.UIElement;
|
|
import meerkat.voting.controller.commands.ControllerCommand;
|
|
import meerkat.voting.controller.commands.ChooseFinalizeOptionCommand;
|
|
import meerkat.voting.controller.commands.ReportErrorCommand;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
|
public class OutputDeviceCommitCallback extends ControllerCallback<Void> {
|
|
protected final static Logger logger = LoggerFactory.getLogger(OutputDeviceCommitCallback.class);
|
|
protected final UIElement outputDeviceFailureMessage;
|
|
|
|
public OutputDeviceCommitCallback(int requestId,
|
|
long ballotSerialNumber,
|
|
LinkedBlockingQueue<ControllerCommand> controllerQueue,
|
|
UIElement outputDeviceFailureMessage) {
|
|
super(requestId, ballotSerialNumber, controllerQueue);
|
|
this.outputDeviceFailureMessage = outputDeviceFailureMessage;
|
|
}
|
|
|
|
@Override
|
|
public void onSuccess(Void v) {
|
|
logger.debug("callback for output device commit success");
|
|
enqueueCommand(new ChooseFinalizeOptionCommand(getRequestIdentifier(), getBallotSerialNumber()));
|
|
}
|
|
|
|
@Override
|
|
public void onFailure(Throwable t) {
|
|
logger.error("OutputDeviceCommitCallback got a failure: " + t);
|
|
enqueueCommand(new ReportErrorCommand(getRequestIdentifier(),
|
|
getBallotSerialNumber(),
|
|
outputDeviceFailureMessage));
|
|
}
|
|
}
|