summaryrefslogtreecommitdiff
path: root/same/src/main/java/com/orbekk/paxos/PaxosServiceImpl.java
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-04-25 12:10:57 +0200
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-04-25 12:10:57 +0200
commit768938fa1e2bfaa5a246e28badefc7d8fe7cadd3 (patch)
tree29e17a0603922c087db4c24804ba22db290e8eaa /same/src/main/java/com/orbekk/paxos/PaxosServiceImpl.java
parenta8b921e07bf4ad1936e01628049a9c6fd7349312 (diff)
Add debug messages in Paxos service.
– Remove old PaxosService.
Diffstat (limited to 'same/src/main/java/com/orbekk/paxos/PaxosServiceImpl.java')
-rw-r--r--same/src/main/java/com/orbekk/paxos/PaxosServiceImpl.java12
1 files changed, 7 insertions, 5 deletions
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<PaxosResponse> 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<PaxosResponse> 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",