summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--same/src/main/java/com/orbekk/same/SameController.java12
-rw-r--r--same/src/main/java/com/orbekk/same/http/JettyServerContainer.java8
-rw-r--r--same/src/main/java/com/orbekk/same/http/ServerContainer.java2
-rw-r--r--same/src/main/java/com/orbekk/same/http/TjwsServerContainer.java6
4 files changed, 18 insertions, 10 deletions
diff --git a/same/src/main/java/com/orbekk/same/SameController.java b/same/src/main/java/com/orbekk/same/SameController.java
index ac99197..1261816 100644
--- a/same/src/main/java/com/orbekk/same/SameController.java
+++ b/same/src/main/java/com/orbekk/same/SameController.java
@@ -3,20 +3,20 @@ package com.orbekk.same;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.orbekk.net.BroadcasterInterface;
import com.orbekk.net.BroadcastListener;
import com.orbekk.net.BroadcasterFactory;
+import com.orbekk.net.BroadcasterInterface;
import com.orbekk.net.DefaultBroadcasterFactory;
import com.orbekk.paxos.PaxosService;
import com.orbekk.paxos.PaxosServiceImpl;
import com.orbekk.same.config.Configuration;
-import com.orbekk.same.http.JettyServerBuilder;
-import com.orbekk.same.http.JettyServerContainer;
+import com.orbekk.same.http.ServerContainer;
import com.orbekk.same.http.StateServlet;
+import com.orbekk.same.http.TjwsServerBuilder;
public class SameController {
private Logger logger = LoggerFactory.getLogger(getClass());
- private JettyServerContainer server;
+ private ServerContainer server;
private Master master;
private Client client;
private PaxosServiceImpl paxos;
@@ -60,7 +60,7 @@ public class SameController {
StateServlet stateServlet = new StateServlet(client.getInterface(),
new VariableFactory(client.getInterface()));
- JettyServerContainer server = new JettyServerBuilder(port)
+ ServerContainer server = new TjwsServerBuilder(port)
.withServlet(stateServlet, "/_/state")
.withService(client.getService(), ClientService.class)
.withService(master.getService(), MasterService.class)
@@ -79,7 +79,7 @@ public class SameController {
public SameController(
Configuration configuration,
- JettyServerContainer server,
+ ServerContainer server,
Master master,
Client client,
PaxosServiceImpl paxos,
diff --git a/same/src/main/java/com/orbekk/same/http/JettyServerContainer.java b/same/src/main/java/com/orbekk/same/http/JettyServerContainer.java
index c15d94d..16d7033 100644
--- a/same/src/main/java/com/orbekk/same/http/JettyServerContainer.java
+++ b/same/src/main/java/com/orbekk/same/http/JettyServerContainer.java
@@ -55,7 +55,11 @@ public class JettyServerContainer implements ServerContainer {
logger.info("Server stopped.");
}
- public void join() throws InterruptedException {
- server.join();
+ public void join() {
+ try {
+ server.join();
+ } catch (InterruptedException e) {
+ return;
+ }
}
}
diff --git a/same/src/main/java/com/orbekk/same/http/ServerContainer.java b/same/src/main/java/com/orbekk/same/http/ServerContainer.java
index 6f87910..b69adbf 100644
--- a/same/src/main/java/com/orbekk/same/http/ServerContainer.java
+++ b/same/src/main/java/com/orbekk/same/http/ServerContainer.java
@@ -4,5 +4,5 @@ public interface ServerContainer {
public abstract int getPort();
public abstract void start() throws Exception;
public abstract void stop() throws Exception;
- public abstract void join() throws Exception;
+ public abstract void join();
} \ No newline at end of file
diff --git a/same/src/main/java/com/orbekk/same/http/TjwsServerContainer.java b/same/src/main/java/com/orbekk/same/http/TjwsServerContainer.java
index ec2f2a2..2aa7efd 100644
--- a/same/src/main/java/com/orbekk/same/http/TjwsServerContainer.java
+++ b/same/src/main/java/com/orbekk/same/http/TjwsServerContainer.java
@@ -1,5 +1,7 @@
package com.orbekk.same.http;
+import java.util.Properties;
+
import javax.servlet.http.HttpServlet;
import org.slf4j.Logger;
@@ -22,8 +24,10 @@ public class TjwsServerContainer implements ServerContainer {
private MyServer server;
public static TjwsServerContainer create(int port) {
+ Properties properties = new Properties();
+ properties.put(Serve.ARG_PORT, port);
MyServer server = new MyServer();
- server.setAttribute(Serve.ARG_PORT, port);
+ server.arguments = properties;
return new TjwsServerContainer(server);
}