public interface Service extends ServiceBase
Modifier and Type | Field and Description |
---|---|
static String |
MIDNIGHT_EVENT
The midnight event name.
|
static String |
PING_SIGNAL
The ping signal name.
|
static String |
PONG_EVENT
The pong event name.
|
static String |
RESTART_NOW_SIGNAL
The restart now signal name.
|
static String |
RESTART_SIGNAL
The restart signal name.
|
static String |
RESUME_SIGNAL
The resume signal name.
|
static String |
RESUMED_EVENT
The service resumed event name.
|
static String |
STARTED_EVENT
The service started event name.
|
static String |
STOP_NOW_SIGNAL
The stop now signal name.
|
static String |
STOP_SIGNAL
The stop signal name.
|
static String |
STOPPED_EVENT
The stopped event name.
|
static String |
SUSPEND_SIGNAL
The suspend signal name.
|
static String |
SUSPENDED_EVENT
The service suspended event name.
|
static String |
WATCHDOG_EVENT
The watchdog event name.
|
static String |
ZOMBIE_EVENT
The service is zombie event name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addAlertListener(Alerter.Listener listener)
Adds an alert listener.
|
void |
disableSuspend()
Disables suspend.
|
void |
enableSuspend()
Enables suspend.
|
boolean |
exportAgent()
Exports the JMX agent.
|
Alerter |
getAlerter()
Gets the alerter.
|
Config |
getConfig()
Gets the service config.
|
File |
getDataDir()
Gets the data directory.
|
Optional<String> |
getEntityName()
Gets the name of the associated entity.
|
long |
getJoinTimeout()
Gets the join timeout.
|
Optional<UUID> |
getOptionalSourceUUID()
Gets the optional source UUID.
|
ServiceActivator |
getServiceActivator()
Gets the service activator owning this.
|
Optional<UUID> |
getServiceUUID()
Gets the service UUID.
|
UUID |
getSourceUUID()
Gets the source UUID.
|
boolean |
isRunning()
Asks if the service is running.
|
boolean |
isStarted()
Asks if the service has been started.
|
boolean |
isStopped()
Asks if the service has been stopped.
|
boolean |
isStopping()
Asks if the service is stopping.
|
boolean |
isWait()
Asks if the service waits until running.
|
boolean |
isZombie()
Asks if the service is a zombie.
|
void |
monitorService(Optional<String> name,
Optional<UUID> uuid,
Optional<String> reference)
Registers a service to be monitored.
|
String |
registerServer(SessionFactory server,
String serverPath)
Registers a RMI server.
|
boolean |
removeAlertListener(Alerter.Listener listener)
Removes an alert listener.
|
void |
restart(boolean delayed)
Restarts the service.
|
void |
restoreConfigState()
Restores the config state.
|
void |
restoreMonitored()
Restores monitored services.
|
void |
resume()
Resumes.
|
void |
saveConfigState()
Saves the config state.
|
void |
saveMonitored()
Saves monitored services.
|
void |
sendAlert(Alert alert)
Sends an alert.
|
void |
sendEvent(String name,
Optional<Object> info)
Sends an event.
|
void |
sendSignal(String name,
Optional<?> info)
Sends a signal.
|
boolean |
setRestartEnabled(boolean restartEnabled)
Sets the restart enabled indicator.
|
void |
setSourceUUID(UUID sourceUUID)
Sets the source UUID.
|
void |
starting()
Informs that the start is progressing.
|
void |
stopping()
Informs that the stop is progressing.
|
void |
suspend()
Suspends.
|
boolean |
trySuspend(long timeout)
Tries to suspend.
|
void |
unregisterServer(String serverName)
Unregisters a RMI server.
|
addStats, fail, getServiceName, getStats, getTimer, isJMXRegistrationEnabled, snooze, starting, stopping, wakeUp
static final String MIDNIGHT_EVENT
static final String PING_SIGNAL
static final String PONG_EVENT
static final String RESTART_NOW_SIGNAL
static final String RESTART_SIGNAL
static final String RESUMED_EVENT
static final String RESUME_SIGNAL
static final String STARTED_EVENT
static final String STOPPED_EVENT
static final String STOP_NOW_SIGNAL
static final String STOP_SIGNAL
static final String SUSPENDED_EVENT
static final String SUSPEND_SIGNAL
static final String WATCHDOG_EVENT
static final String ZOMBIE_EVENT
@CheckReturnValue boolean addAlertListener(@Nonnull Alerter.Listener listener)
listener
- The listener to be added.void disableSuspend() throws InterruptedException
InterruptedException
- When interrupted.void enableSuspend()
@CheckReturnValue boolean exportAgent()
@Nonnull @CheckReturnValue Alerter getAlerter()
@Nonnull @CheckReturnValue Config getConfig()
@Nonnull @CheckReturnValue File getDataDir()
@Nonnull @CheckReturnValue Optional<String> getEntityName()
@CheckReturnValue long getJoinTimeout()
@Nonnull @CheckReturnValue Optional<UUID> getOptionalSourceUUID()
@Nonnull @CheckReturnValue ServiceActivator getServiceActivator()
@Nonnull @CheckReturnValue Optional<UUID> getServiceUUID()
@Nonnull @CheckReturnValue UUID getSourceUUID()
@CheckReturnValue boolean isRunning()
@CheckReturnValue boolean isStarted()
@CheckReturnValue boolean isStopped()
@CheckReturnValue boolean isStopping()
@CheckReturnValue boolean isWait()
@CheckReturnValue boolean isZombie()
void monitorService(@Nonnull Optional<String> name, @Nonnull Optional<UUID> uuid, @Nonnull Optional<String> reference)
Does nothing if the service name and UUID are both empty.
name
- The optional service name.uuid
- The optional UUID identifying the service.reference
- An optional service reference.@Nullable @CheckReturnValue String registerServer(@Nonnull SessionFactory server, @Nonnull String serverPath)
server
- The server object.serverPath
- The path to the server.@CheckReturnValue boolean removeAlertListener(@Nonnull Alerter.Listener listener)
listener
- The listener to be removed.void restart(boolean delayed)
delayed
- A true value if start should be delayed.void restoreConfigState()
void restoreMonitored()
void resume()
void saveConfigState()
void saveMonitored()
void sendAlert(@Nonnull Alert alert)
alert
- The alert.void sendEvent(@Nonnull String name, @Nonnull Optional<Object> info)
name
- The event's name.info
- Additional optional informations.void sendSignal(@Nonnull String name, @Nonnull Optional<?> info)
name
- The signal's name.info
- Additional optional informations.@CheckReturnValue boolean setRestartEnabled(boolean restartEnabled)
restartEnabled
- The restart enabled indicator.void setSourceUUID(@Nonnull UUID sourceUUID)
sourceUUID
- The source UUID.void starting()
void stopping()
void suspend() throws InterruptedException
InterruptedException
- When interrupted.@CheckReturnValue boolean trySuspend(long timeout) throws InterruptedException
timeout
- The timeout in milliseconds.InterruptedException
- When interrupted.void unregisterServer(@Nonnull String serverName)
serverName
- The name of the server.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.