summaryrefslogtreecommitdiff
path: root/same/src/main/java/com/orbekk/same/SameController.java
diff options
context:
space:
mode:
Diffstat (limited to 'same/src/main/java/com/orbekk/same/SameController.java')
-rw-r--r--same/src/main/java/com/orbekk/same/SameController.java38
1 files changed, 5 insertions, 33 deletions
diff --git a/same/src/main/java/com/orbekk/same/SameController.java b/same/src/main/java/com/orbekk/same/SameController.java
index e9a7916..c1c7901 100644
--- a/same/src/main/java/com/orbekk/same/SameController.java
+++ b/same/src/main/java/com/orbekk/same/SameController.java
@@ -11,7 +11,6 @@ import com.orbekk.paxos.PaxosService;
import com.orbekk.paxos.PaxosServiceImpl;
import com.orbekk.same.config.Configuration;
import com.orbekk.same.discovery.DirectoryService;
-import com.orbekk.same.discovery.DiscoveryService;
import com.orbekk.same.http.ServerContainer;
import com.orbekk.same.http.StateServlet;
import com.orbekk.same.http.JettyServerBuilder;
@@ -24,7 +23,6 @@ public class SameController {
private Master master;
private Client client;
private PaxosServiceImpl paxos;
- private DiscoveryService discoveryService;
private BroadcasterFactory broadcasterFactory;
private Configuration configuration;
private ConnectionManager connections;
@@ -81,13 +79,6 @@ public class SameController {
clientUrl, BroadcasterImpl.getDefaultBroadcastRunner());
PaxosServiceImpl paxos = new PaxosServiceImpl("");
- DiscoveryService discoveryService = null;
- if ("true".equals(configuration.get("enableDiscovery"))) {
- BroadcastListener broadcastListener = new BroadcastListener(
- configuration.getInt("discoveryPort"));
- discoveryService = new DiscoveryService(client, broadcastListener);
- }
-
StateServlet stateServlet = new StateServlet(client.getInterface(),
new VariableFactory(client.getInterface()));
@@ -100,7 +91,7 @@ public class SameController {
SameController controller = new SameController(
configuration, connections, server, master, client,
- paxos, discoveryService, broadcaster, broadcasterFactory);
+ paxos, broadcaster, broadcasterFactory);
return controller;
}
@@ -115,7 +106,6 @@ public class SameController {
MasterServiceProxy master,
Client client,
PaxosServiceImpl paxos,
- DiscoveryService discoveryService,
Broadcaster serviceBroadcaster,
BroadcasterFactory broadcasterFactory) {
this.configuration = configuration;
@@ -124,7 +114,6 @@ public class SameController {
this.masterService = master;
this.client = client;
this.paxos = paxos;
- this.discoveryService = discoveryService;
this.serviceBroadcaster = serviceBroadcaster;
this.broadcasterFactory = broadcasterFactory;
}
@@ -133,9 +122,6 @@ public class SameController {
server.start();
client.setMasterController(masterController);
client.start();
- if (discoveryService != null) {
- discoveryService.start();
- }
}
public void stop() {
@@ -145,30 +131,16 @@ public class SameController {
master.interrupt();
}
server.stop();
- if (discoveryService != null) {
- discoveryService.interrupt();
- }
} catch (Exception e) {
logger.error("Failed to stop webserver", e);
}
}
public void join() {
- try {
- server.join();
- client.interrupt();
- if (master != null) {
- master.interrupt();
- }
- if (discoveryService != null) {
- discoveryService.join();
- }
- } catch (InterruptedException e) {
- try {
- server.stop();
- } catch (Exception e1) {
- logger.error("Failed to stop server", e);
- }
+ server.join();
+ client.interrupt();
+ if (master != null) {
+ master.interrupt();
}
}