Im using the Grizzly Http Server on my webserver to serve a REST API. After some time the server is working more and more to full capacity even there are no more users online.
In htop i can see that there are some grizzly http threads (at this time in the picture one) which are using 100% of one kernal. How is that possible? Any ideas?
Code:
/* IMPORTS */
public class WebAppServer {
private static WebAppServer instance;
public static WebAppServer getInstance() {
if (instance == null) instance = new WebAppServer();
return instance;
}
public void start() throws IOException, URISyntaxException {
String baseUrl = MavenPropertyDao.getInstance().getProperty(MavenPropertyDao.REST_SERVER_URL);
ResourceConfig rc = new MyConfig();
rc.register(new CORSFilter());
rc.registerClasses(/* REST CLASSES */);
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(new URI(baseUrl), rc);
Runtime.getRuntime().addShutdownHook(new Thread(server::stop));
server.start();
}
public class MyConfig extends ResourceConfig {
public MyConfig() {
register(new HttpExceptionHandler());
register(MultiPartFeature.class);
register(GsonProvider.class);
property(ServerProperties.MONITORING_STATISTICS_ENABLED, true);
}
}
}
