class Sync implements Synchronization {
protected final Command successCommand;
protected final Command failureCommand;
public Sync() {
successCommand = new DeleteCommand(getEndpoint());
if (BeanstalkComponent.COMMAND_BURY.equals(onFailure)) {
failureCommand = new BuryCommand(getEndpoint());
} else if (BeanstalkComponent.COMMAND_RELEASE.equals(onFailure)) {
failureCommand = new ReleaseCommand(getEndpoint());
} else if (BeanstalkComponent.COMMAND_DELETE.equals(onFailure)) {
failureCommand = new DeleteCommand(getEndpoint());
} else {
throw new IllegalArgumentException(String.format("Unknown failure command: %s", onFailure));
}
}