This commit is contained in:
@@ -464,8 +464,8 @@ public final class Application {
|
|||||||
final String protocol = serconf.getValue("protocol", "").replaceFirst("\\..+", "").toUpperCase();
|
final String protocol = serconf.getValue("protocol", "").replaceFirst("\\..+", "").toUpperCase();
|
||||||
NodeServer server = null;
|
NodeServer server = null;
|
||||||
if ("SNCP".equals(protocol)) {
|
if ("SNCP".equals(protocol)) {
|
||||||
server = new NodeSncpServer(Application.this, serconf);
|
server = NodeSncpServer.createNodeServer(Application.this, serconf);
|
||||||
} else if ("HTTP".equals(protocol)) {
|
} else if ("HTTP".equalsIgnoreCase(protocol)) {
|
||||||
server = new NodeHttpServer(Application.this, serconf);
|
server = new NodeHttpServer(Application.this, serconf);
|
||||||
} else {
|
} else {
|
||||||
if (!inited.get()) {
|
if (!inited.get()) {
|
||||||
|
|||||||
@@ -24,12 +24,19 @@ public final class NodeSncpServer extends NodeServer {
|
|||||||
|
|
||||||
private final SncpServer sncpServer;
|
private final SncpServer sncpServer;
|
||||||
|
|
||||||
public NodeSncpServer(Application application, AnyValue serconf) {
|
private NodeSncpServer(Application application, AnyValue serconf) {
|
||||||
super(application, createServer(application, serconf));
|
super(application, createServer(application, serconf));
|
||||||
this.sncpServer = (SncpServer) this.server;
|
this.sncpServer = (SncpServer) this.server;
|
||||||
this.consumer = sncpServer == null ? null : x -> sncpServer.addService(x);
|
this.consumer = sncpServer == null ? null : x -> sncpServer.addService(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static NodeServer createNodeServer(Application application, AnyValue serconf) {
|
||||||
|
if (serconf != null && serconf.getAnyValue("rest") != null) {
|
||||||
|
return new NodeHttpServer(application, serconf);
|
||||||
|
}
|
||||||
|
return new NodeSncpServer(application, serconf);
|
||||||
|
}
|
||||||
|
|
||||||
private static Server createServer(Application application, AnyValue serconf) {
|
private static Server createServer(Application application, AnyValue serconf) {
|
||||||
return new SncpServer(application.getStartTime(), application.getWatchFactory());
|
return new SncpServer(application.getStartTime(), application.getWatchFactory());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user