Class TomcatStatusProvider
java.lang.Object
com.github.jpmsilva.jsystemd.spring.TomcatStatusProvider
- All Implemented Interfaces:
StatusProvider,EventListener,ApplicationListener<WebServerInitializedEvent>
public class TomcatStatusProvider
extends Object
implements StatusProvider, ApplicationListener<WebServerInitializedEvent>
Implementation of
StatusProvider that provides information regarding the connectors of the embedded Tomcat servers of the application.
For each connector, it reports the open connections out of the maximum the connector accepts, and, when the requests are handled by a thread pool
rather than by virtual threads, the busy threads out of the threads in the pool, such as http-nio-8080: 8/8192 connections, 3/10 threads. A
connector that accepts unlimited connections only reports its threads, and one 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 whose connectors are reported, if it is a Tomcat 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
-
TomcatStatusProvider
public TomcatStatusProvider()Create a new TomcatStatusProvider.
-
-
Method Details
-
onApplicationEvent
Adds the server of the event to the servers whose connectors are reported, if it is a Tomcat 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
-