use of org.apache.skywalking.apm.collector.server.jetty.JettyServer in project incubator-skywalking by apache.
the class AgentModuleJettyProvider method start.
@Override
public void start(Properties config) throws ServiceNotProvidedException {
String host = config.getProperty(HOST);
Integer port = (Integer) config.get(PORT);
String contextPath = config.getProperty(CONTEXT_PATH);
ModuleRegisterService moduleRegisterService = getManager().find(ClusterModule.NAME).getService(ModuleRegisterService.class);
moduleRegisterService.register(AgentJettyModule.NAME, this.name(), new AgentModuleJettyRegistration(host, port, contextPath));
AgentJettyNamingListener namingListener = new AgentJettyNamingListener();
ModuleListenerService moduleListenerService = getManager().find(ClusterModule.NAME).getService(ModuleListenerService.class);
moduleListenerService.addListener(namingListener);
NamingHandlerRegisterService namingHandlerRegisterService = getManager().find(NamingModule.NAME).getService(NamingHandlerRegisterService.class);
namingHandlerRegisterService.register(new AgentJettyNamingHandler(namingListener));
JettyManagerService managerService = getManager().find(JettyManagerModule.NAME).getService(JettyManagerService.class);
JettyServer jettyServer = managerService.createIfAbsent(host, port, contextPath);
addHandlers(jettyServer);
}
use of org.apache.skywalking.apm.collector.server.jetty.JettyServer in project incubator-skywalking by apache.
the class UIModuleJettyProvider method start.
@Override
public void start(Properties config) throws ServiceNotProvidedException {
String host = config.getProperty(HOST);
Integer port = (Integer) config.get(PORT);
String contextPath = config.getProperty(CONTEXT_PATH);
ModuleRegisterService moduleRegisterService = getManager().find(ClusterModule.NAME).getService(ModuleRegisterService.class);
moduleRegisterService.register(UIModule.NAME, this.name(), new UIModuleJettyRegistration(host, port, contextPath));
UIJettyNamingListener namingListener = new UIJettyNamingListener();
ModuleListenerService moduleListenerService = getManager().find(ClusterModule.NAME).getService(ModuleListenerService.class);
moduleListenerService.addListener(namingListener);
NamingHandlerRegisterService namingHandlerRegisterService = getManager().find(NamingModule.NAME).getService(NamingHandlerRegisterService.class);
namingHandlerRegisterService.register(new UIJettyNamingHandler(namingListener));
JettyManagerService managerService = getManager().find(JettyManagerModule.NAME).getService(JettyManagerService.class);
JettyServer jettyServer = managerService.createIfAbsent(host, port, contextPath);
addHandlers(jettyServer);
}
use of org.apache.skywalking.apm.collector.server.jetty.JettyServer 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;
}
}
Aggregations