Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[breaking] servers - removing SimpleWebServer's constructor & builder…
… serverId useless field
  • Loading branch information
fcamblor committed Sep 9, 2017
1 parent 6b20ac6 commit f24469d
Showing 1 changed file with 3 additions and 13 deletions.
Expand Up @@ -33,7 +33,6 @@ public static class SimpleWebServerBuilder {
private int port;
private String routerPath = "/api";
private String appBase = null;
private String serverId;
private RestxMainRouter router;
public SimpleWebServerBuilder setPort(int port) {
this.port = port;
Expand All @@ -50,23 +49,14 @@ public SimpleWebServerBuilder setAppBase(String appBase) {
return this;
}

public SimpleWebServerBuilder setServerId(String serverId) {
this.serverId = serverId;
return this;
}

public SimpleWebServerBuilder setRouter(RestxMainRouter router) {
this.router = router;
return this;
}

public SimpleWebServer build() {
if (serverId == null) {
serverId = "SimpleWebServer#" + SERVER_ID.incrementAndGet();
}

if (router == null) {
return new SimpleWebServer(serverId, routerPath, appBase, port) {
return new SimpleWebServer(routerPath, appBase, port) {
@Override
protected RestxMainRouter setupRouter() {
return RestxMainRouterFactory.newInstance(
Expand All @@ -82,7 +72,7 @@ public synchronized void stop() throws Exception {
}
};
} else {
return new SimpleWebServer(serverId, routerPath, appBase, port) {
return new SimpleWebServer(routerPath, appBase, port) {
@Override
protected RestxMainRouter setupRouter() {
return router;
Expand All @@ -104,7 +94,7 @@ public static SimpleWebServerBuilder builder() {
private RestxMainRouter router;
private Connection connection;

private SimpleWebServer(String serverId, String routerPath, String appBase, int port) {
private SimpleWebServer(String routerPath, String appBase, int port) {
super(appBase, port, "localhost", "SimpleFrameowkr", "org.simpleframework", "simple");

this.routerPath = routerPath;
Expand Down

0 comments on commit f24469d

Please sign in to comment.