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