From 768938fa1e2bfaa5a246e28badefc7d8fe7cadd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Wed, 25 Apr 2012 12:10:57 +0200 Subject: Add debug messages in Paxos service. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit – Remove old PaxosService. --- same/src/main/java/com/orbekk/paxos/PaxosServiceImpl.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'same/src/main/java/com/orbekk/paxos/PaxosServiceImpl.java') diff --git a/same/src/main/java/com/orbekk/paxos/PaxosServiceImpl.java b/same/src/main/java/com/orbekk/paxos/PaxosServiceImpl.java index 6b9dd14..40e6320 100644 --- a/same/src/main/java/com/orbekk/paxos/PaxosServiceImpl.java +++ b/same/src/main/java/com/orbekk/paxos/PaxosServiceImpl.java @@ -12,7 +12,7 @@ import com.orbekk.same.Services.PaxosResponse; /** * This class better be thread-safe. */ -public class PaxosServiceImpl implements PaxosService { +public class PaxosServiceImpl { private Logger logger = LoggerFactory.getLogger(getClass()); private int highestPromise = 0; private int highestAcceptedValue = 0; @@ -23,6 +23,8 @@ public class PaxosServiceImpl implements PaxosService { @Override public void propose(RpcController controller, PaxosRequest request, RpcCallback done) { + logger.info("propose({}). Highest promise: {}, Highest accepted: {}", + new Object[]{request, highestPromise, highestAcceptedValue}); String clientUrl = request.getClient().getLocation(); int proposalNumber = request.getProposalNumber(); int response = @@ -36,6 +38,8 @@ public class PaxosServiceImpl implements PaxosService { @Override public void acceptRequest(RpcController controller, PaxosRequest request, RpcCallback done) { + logger.info("acceptRequest({}). Highest promise: {}, Highest accepted: {}", + new Object[]{request, highestPromise, highestAcceptedValue}); String clientUrl = request.getClient().getLocation(); int proposalNumber = request.getProposalNumber(); int response = @@ -56,8 +60,7 @@ public class PaxosServiceImpl implements PaxosService { return service; } - @Override - public synchronized int propose(String clientUrl, + private synchronized int propose(String clientUrl, int proposalNumber) { if (proposalNumber > highestPromise) { logger.info(tag + "propose({}, {}) = accepted", @@ -73,8 +76,7 @@ public class PaxosServiceImpl implements PaxosService { } } - @Override - public synchronized int acceptRequest(String clientUrl, + private synchronized int acceptRequest(String clientUrl, int proposalNumber) { if (proposalNumber == highestPromise) { logger.info(tag + "acceptRequest({}, {}) = accepted", -- cgit v1.2.3