// Path: r4j/src/org/r4j/CommitHandler.java
// public interface CommitHandler {
// 
// 	/**
// 	 * Commits the entry. Should NEVER fail. Retry should be handled by CommitHandler implementation
// 	 * @param entry
// 	 */
// 	public void commit(AppendRequest entry);
// 	
// 	public void reject(AppendRequest entry);
// }
// 
// Path: r4j/src/org/r4j/protocol/AppendRequest.java
// public class AppendRequest {
// 
// 	private long index;
// 	private long leaderTerm;
// 	private long logTerm;
// 	private long previousIndex;
// 	private long previousTerm;
// 	private long commitIndex;
// 	private Object payload;
// 	private transient MessageChannel clientChannel;
// 	
// 	public AppendRequest() {
// 		super();
// 	}
// 
// 	public AppendRequest(long logTerm, long index, long leaderTerm, long previousIndex,
// 			long previousTerm, long commitIndex, Object payload) {
// 		super();
// 		this.logTerm = logTerm;
// 		this.index = index;
// 		this.leaderTerm = leaderTerm;
// 		this.previousIndex = previousIndex;
// 		this.previousTerm = previousTerm;
// 		this.commitIndex = commitIndex;
// 		this.payload = payload;
// 	}
// 
// 	public AppendRequest(long logTerm, long index, long leaderTerm, long previousIndex,
// 			long previousTerm, long commitIndex, Object payload,
// 			MessageChannel clientChannel) {
// 		super();
// 		this.logTerm = logTerm;
// 		this.index = index;
// 		this.leaderTerm = leaderTerm;
// 		this.previousIndex = previousIndex;
// 		this.previousTerm = previousTerm;
// 		this.commitIndex = commitIndex;
// 		this.payload = payload;
// 		this.clientChannel = clientChannel;
// 	}
// 
// 	public long getIndex() {
// 		return index;
// 	}
// 
// 	public long getLeaderTerm() {
// 		return leaderTerm;
// 	}
// 
// 	public long getLogTerm() {
// 		return logTerm;
// 	}
// 
// 	public long getPreviousIndex() {
// 		return previousIndex;
// 	}
// 
// 	public long getPreviousTerm() {
// 		return previousTerm;
// 	}
// 
// 	public long getCommitIndex() {
// 		return commitIndex;
// 	}
// 
// 	public Object getPayload() {
// 		return payload;
// 	}
// 
// 	@JsonIgnore
// 	public MessageChannel getClientChannel() {
// 		return clientChannel;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "AppendRequest [index=" + index + ", term=" + leaderTerm
// 				+ ", previousIndex=" + previousIndex + ", previousTerm="
// 				+ previousTerm + ", commitIndex=" + commitIndex + ", "
// 				+ (payload != null ? "payload=" + payload : "") + "]";
// 	}
// 
// 	
// }
// 
// Path: r4j/src/org/r4j/protocol/ClientResponse.java
// public class ClientResponse {
// 
// 	private int errCode;
// 	
// 	private Object payload;
// 
// 	public ClientResponse(int errCode, Object payload) {
// 		super();
// 		this.errCode = errCode;
// 		this.payload = payload;
// 	}
// 
// 	public ClientResponse() {
// 		super();
// 	}
// 
// 	public int getErrCode() {
// 		return errCode;
// 	}
// 
// 	public Object getPayload() {
// 		return payload;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "ClientResponse [errCode=" + errCode + ", payload=" + payload
// 				+ "]";
// 	}
// 	
// }


import org.r4j.CommitHandler;
import org.r4j.protocol.AppendRequest;
import org.r4j.protocol.ClientResponse;

package org.r4j.example;


public class RespondingCommitHandler implements CommitHandler {

	@Override

// Path: r4j/src/org/r4j/CommitHandler.java
// public interface CommitHandler {
// 
// 	/**
// 	 * Commits the entry. Should NEVER fail. Retry should be handled by CommitHandler implementation
// 	 * @param entry
// 	 */
// 	public void commit(AppendRequest entry);
// 	
// 	public void reject(AppendRequest entry);
// }
// 
// Path: r4j/src/org/r4j/protocol/AppendRequest.java
// public class AppendRequest {
// 
// 	private long index;
// 	private long leaderTerm;
// 	private long logTerm;
// 	private long previousIndex;
// 	private long previousTerm;
// 	private long commitIndex;
// 	private Object payload;
// 	private transient MessageChannel clientChannel;
// 	
// 	public AppendRequest() {
// 		super();
// 	}
// 
// 	public AppendRequest(long logTerm, long index, long leaderTerm, long previousIndex,
// 			long previousTerm, long commitIndex, Object payload) {
// 		super();
// 		this.logTerm = logTerm;
// 		this.index = index;
// 		this.leaderTerm = leaderTerm;
// 		this.previousIndex = previousIndex;
// 		this.previousTerm = previousTerm;
// 		this.commitIndex = commitIndex;
// 		this.payload = payload;
// 	}
// 
// 	public AppendRequest(long logTerm, long index, long leaderTerm, long previousIndex,
// 			long previousTerm, long commitIndex, Object payload,
// 			MessageChannel clientChannel) {
// 		super();
// 		this.logTerm = logTerm;
// 		this.index = index;
// 		this.leaderTerm = leaderTerm;
// 		this.previousIndex = previousIndex;
// 		this.previousTerm = previousTerm;
// 		this.commitIndex = commitIndex;
// 		this.payload = payload;
// 		this.clientChannel = clientChannel;
// 	}
// 
// 	public long getIndex() {
// 		return index;
// 	}
// 
// 	public long getLeaderTerm() {
// 		return leaderTerm;
// 	}
// 
// 	public long getLogTerm() {
// 		return logTerm;
// 	}
// 
// 	public long getPreviousIndex() {
// 		return previousIndex;
// 	}
// 
// 	public long getPreviousTerm() {
// 		return previousTerm;
// 	}
// 
// 	public long getCommitIndex() {
// 		return commitIndex;
// 	}
// 
// 	public Object getPayload() {
// 		return payload;
// 	}
// 
// 	@JsonIgnore
// 	public MessageChannel getClientChannel() {
// 		return clientChannel;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "AppendRequest [index=" + index + ", term=" + leaderTerm
// 				+ ", previousIndex=" + previousIndex + ", previousTerm="
// 				+ previousTerm + ", commitIndex=" + commitIndex + ", "
// 				+ (payload != null ? "payload=" + payload : "") + "]";
// 	}
// 
// 	
// }
// 
// Path: r4j/src/org/r4j/protocol/ClientResponse.java
// public class ClientResponse {
// 
// 	private int errCode;
// 	
// 	private Object payload;
// 
// 	public ClientResponse(int errCode, Object payload) {
// 		super();
// 		this.errCode = errCode;
// 		this.payload = payload;
// 	}
// 
// 	public ClientResponse() {
// 		super();
// 	}
// 
// 	public int getErrCode() {
// 		return errCode;
// 	}
// 
// 	public Object getPayload() {
// 		return payload;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "ClientResponse [errCode=" + errCode + ", payload=" + payload
// 				+ "]";
// 	}
// 	
// }


// Path: r4j/src/org/r4j/example/RespondingCommitHandler.java
import org.r4j.CommitHandler;
import org.r4j.protocol.AppendRequest;
import org.r4j.protocol.ClientResponse;

package org.r4j.example;


public class RespondingCommitHandler implements CommitHandler {

	@Override

	public void commit(AppendRequest entry) {
