public interface ServiceBase
extends Thread.UncaughtExceptionHandler
Modifier and Type | Method and Description |
---|---|
void |
addStats(ServiceStats serviceStats)
Adds supplementary service stats.
|
void |
fail()
Fails the service.
|
String |
getServiceName()
Gets the Service name.
|
ServiceStats |
getStats()
Gets the service stats.
|
Optional<Timer> |
getTimer()
Gets the service timer.
|
boolean |
isJMXRegistrationEnabled()
Asks if the JMX registration is enabled.
|
void |
snooze(ElapsedTime snoozeTime)
Snoozes for the specified time.
|
void |
starting(Optional<ElapsedTime> waitHint)
Informs that the start is progressing.
|
void |
stopping(Optional<ElapsedTime> waitHint)
Informs that the stop is progressing.
|
void |
wakeUp()
Wakes up all snoozers.
|
void addStats(@Nonnull ServiceStats serviceStats)
serviceStats
- The service stats.void fail()
This is called by the service implementation or one of its children when an unexpected condition is detected. It may be overridden.
@Nonnull @CheckReturnValue String getServiceName()
@Nonnull @CheckReturnValue ServiceStats getStats()
@Nonnull @CheckReturnValue Optional<Timer> getTimer()
@CheckReturnValue boolean isJMXRegistrationEnabled()
void snooze(@Nonnull ElapsedTime snoozeTime) throws InterruptedException
Caution: calling this method while holding a lock object other than this instance may cause a stall.
snoozeTime
- The snooze time.InterruptedException
- When interrupted.void starting(@Nonnull Optional<ElapsedTime> waitHint)
waitHint
- An optional additional time in milliseconds.void stopping(@Nonnull Optional<ElapsedTime> waitHint)
waitHint
- Additional time in milliseconds.void wakeUp()
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.