public class LoggingServiceListener
extends com.google.common.util.concurrent.Service.Listener
Service instances so that service lifecycle changes can easily
be logged without having to manually write listeners everywhere.
Service.State#RUNNING as that is
the most common case. If you need additional, or more complex listeners, add a new instance in addition to this simple
class.| Constructor and Description |
|---|
LoggingServiceListener(String serviceName,
String id)
Creates a new logging listener for the service name and an id.
|
LoggingServiceListener(String serviceName,
String id,
@NotNull org.slf4j.Logger logger) |
LoggingServiceListener(String serviceName,
String id,
Runnable action,
@NotNull org.slf4j.Logger logger) |
| Modifier and Type | Method and Description |
|---|---|
void |
failed(com.google.common.util.concurrent.Service.State from,
Throwable failure) |
void |
running() |
void |
starting() |
void |
stopping(com.google.common.util.concurrent.Service.State from) |
void |
terminated(com.google.common.util.concurrent.Service.State from) |
public LoggingServiceListener(String serviceName, String id)
serviceName - the concise name describing the service being listened to (e.g. "Input" or "Cache")id - the unique id of the service instance, useful if there are more than one running.public LoggingServiceListener(String serviceName, String id, @NotNull @NotNull org.slf4j.Logger logger)
public void starting()
starting in class com.google.common.util.concurrent.Service.Listenerpublic void running()
running in class com.google.common.util.concurrent.Service.Listenerpublic void stopping(com.google.common.util.concurrent.Service.State from)
stopping in class com.google.common.util.concurrent.Service.Listenerpublic void terminated(com.google.common.util.concurrent.Service.State from)
terminated in class com.google.common.util.concurrent.Service.Listenerpublic void failed(com.google.common.util.concurrent.Service.State from,
Throwable failure)
failed in class com.google.common.util.concurrent.Service.ListenerCopyright © 2012–2021 Graylog, Inc.. All rights reserved.