Class JettyStatusProvider
java.lang.Object
com.github.jpmsilva.jsystemd.spring.JettyStatusProvider
- All Implemented Interfaces:
StatusProvider,EventListener,ApplicationListener<WebServerInitializedEvent>
public class JettyStatusProvider
extends Object
implements StatusProvider, ApplicationListener<WebServerInitializedEvent>
Implementation of
StatusProvider that provides information regarding the embedded Jetty servers of the application.
For each server, named after the port it listens on, it reports the open connections, out of the maximum the server accepts when limited, and, when
the requests are handled by a thread pool rather than by virtual threads, the threads running requests out of the threads in the pool, such as
jetty-8080: 12/1000 connections, 3/10 threads. The threads Jetty keeps for itself, to accept connections and wait for their data, are left out of
the threads running requests. A server that is not started is left out.
The servers are found as they start, from their WebServerInitializedEvent: the server of the application, as well as the server of the
management endpoints when they use a port of their own. Nothing is reported until then.
- Author:
- Joao Silva
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the server of the event to the servers that are reported, if it is a Jetty server.status()Exposes status information to send to systemd.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
JettyStatusProvider
public JettyStatusProvider()Create a new JettyStatusProvider.
-
-
Method Details
-
onApplicationEvent
Adds the server of the event to the servers that are reported, if it is a Jetty server.- Specified by:
onApplicationEventin interfaceApplicationListener<WebServerInitializedEvent>- Parameters:
event- the event of a web server that started
-
status
Description copied from interface:StatusProviderExposes status information to send to systemd.- Specified by:
statusin interfaceStatusProvider- Returns:
- the string message to add to the service status
-