summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-05-10 14:56:25 +0200
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-05-10 14:56:25 +0200
commit1f2499b6ec908342f217288342e19f0ee05ef58f (patch)
treedc07c70f611dd51ef9b3304d03ea897fe6870102
parent816d4613d7d2fe0366b6913f2a6124e08c21549d (diff)
Reduce master rpc timeout.
RPCs from a master should have a lower timeout than client RPCs, otherwise the master may not be able to respond to client requests in time.
-rw-r--r--same/src/main/java/com/orbekk/same/SameController.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/same/src/main/java/com/orbekk/same/SameController.java b/same/src/main/java/com/orbekk/same/SameController.java
index 8f225c6..5794ce7 100644
--- a/same/src/main/java/com/orbekk/same/SameController.java
+++ b/same/src/main/java/com/orbekk/same/SameController.java
@@ -42,6 +42,7 @@ public class SameController {
private final Configuration configuration;
private final ConnectionManager connections;
private final RpcFactory rpcf;
+ private final RpcFactory masterRpcf;
/**
* Timeout for remote operations in milliseconds.
@@ -91,7 +92,7 @@ public class SameController {
"MasterService.json";
master = Master.create(connections,
masterUrl, configuration.get("networkName"), myLocation,
- rpcf);
+ masterRpcf);
master.resumeFrom(lastKnownState, masterId);
pServer.registerService(master.getNewService());
master.start();
@@ -130,6 +131,7 @@ public class SameController {
ConnectionManagerImpl connections = new ConnectionManagerImpl(
timeout, timeout);
RpcFactory rpcf = new RpcFactory(timeout);
+ RpcFactory masterRpcf = new RpcFactory(timeout / 2);
State clientState = new State();
String baseUrl = String.format("http://%s:%s/",
@@ -147,7 +149,7 @@ public class SameController {
SameController controller = new SameController(
configuration, connections, client,
- paxos, pServer, rpcf);
+ paxos, pServer, rpcf, masterRpcf);
pServer.registerService(controller.new SystemServiceImpl());
return controller;
@@ -159,13 +161,15 @@ public class SameController {
Client client,
PaxosServiceImpl paxos,
SimpleProtobufServer pServer,
- RpcFactory rpcf) {
+ RpcFactory rpcf,
+ RpcFactory masterRpcf) {
this.configuration = configuration;
this.connections = connections;
this.client = client;
this.paxos = paxos;
this.pServer = pServer;
this.rpcf = rpcf;
+ this.masterRpcf = masterRpcf;
}
public void start() throws Exception {