Search in sources :

Example 1 with ServerException

use of org.apache.skywalking.apm.collector.server.ServerException in project incubator-skywalking by apache.

the class GRPCManagerServiceImpl method createOrChooseServer.

private GRPCServer createOrChooseServer(String host, int port, GRPCServer newServer) throws ServerCanNotBeCreatedException {
    String id = host + String.valueOf(port);
    GRPCServer existServer = servers.get(id);
    if (existServer != null) {
        if (existServer.isStatusEqual(newServer)) {
            return existServer;
        } else {
            throw new ServerCanNotBeCreatedException("Can't create server with same port but different setting. SSL setting must equal too.");
        }
    } else {
        try {
            newServer.initialize();
        } catch (ServerException e) {
            logger.error(e.getMessage(), e);
        }
        servers.put(id, newServer);
        return newServer;
    }
}
Also used : GRPCServer(org.apache.skywalking.apm.collector.server.grpc.GRPCServer) ServerException(org.apache.skywalking.apm.collector.server.ServerException)

Example 2 with ServerException

use of org.apache.skywalking.apm.collector.server.ServerException in project incubator-skywalking by apache.

the class JettyManagerServiceImpl method createIfAbsent.

@Override
public JettyServer createIfAbsent(String host, int port, String contextPath) {
    String id = host + String.valueOf(port);
    if (servers.containsKey(id)) {
        return servers.get(id);
    } else {
        JettyServer server = new JettyServer(host, port, contextPath);
        try {
            server.initialize();
        } catch (ServerException e) {
            logger.error(e.getMessage(), e);
        }
        servers.put(id, server);
        return server;
    }
}
Also used : ServerException(org.apache.skywalking.apm.collector.server.ServerException) JettyServer(org.apache.skywalking.apm.collector.server.jetty.JettyServer)

Aggregations

ServerException (org.apache.skywalking.apm.collector.server.ServerException)2 GRPCServer (org.apache.skywalking.apm.collector.server.grpc.GRPCServer)1 JettyServer (org.apache.skywalking.apm.collector.server.jetty.JettyServer)1