public class MetadataServiceAppHolderImpl extends MetadataServiceImpl
Modifier and Type | Field and Description |
---|---|
static String |
SERVICE_APP_CLASS_PROPERTY
The class of the service application to activate.
|
DEFAULT_JOIN_TIMEOUT, DEFAULT_RESTART_DELAY, DEFAULT_STARTING_EXTEND, DEFAULT_STOPPING_EXTEND, DEPENDENCY_PROPERTY, JOIN_TIMEOUT_PROPERTY, MEMORY_LOG_INTERVAL_PROPERTY, MONITOR_DISABLED_PROPERTY, RESTART_ALLOWED_PROPERTY, RESTART_DELAY_PROPERTY, RESTART_IGNORED_PROPERTY, SERVICE_LOG_ID_PROPERTY, SERVICE_UUID_PROPERTY, STARTING_EXTEND_PROPERTY, STARTUP_DELAY_PROPERTY, STATS_LOG_ENABLED_PROPERTY, STOPPING_EXTEND_PROPERTY, ZOMBIE_ENABLED_PROPERTY
REFRESH_METADATA_SIGNAL
MIDNIGHT_EVENT, PING_SIGNAL, PONG_EVENT, RESTART_NOW_SIGNAL, RESTART_SIGNAL, RESUME_SIGNAL, RESUMED_EVENT, STARTED_EVENT, STOP_NOW_SIGNAL, STOP_SIGNAL, STOPPED_EVENT, SUSPEND_SIGNAL, SUSPENDED_EVENT, WATCHDOG_EVENT, ZOMBIE_EVENT
Constructor and Description |
---|
MetadataServiceAppHolderImpl() |
Modifier and Type | Method and Description |
---|---|
protected ServiceStats |
createStats(StatsOwner statsOwner)
Creates a stats instance.
|
protected boolean |
doPendingActions()
Does pending actions.
|
protected void |
doStart()
Does start.
|
protected void |
doStop()
Does stop.
|
Optional<String> |
getEntityName()
Gets the name of the associated entity.
|
protected MetadataServiceApp |
getMetadataServiceApp()
Gets the metadata service application.
|
protected ClassDef |
getServiceAppClassDef()
Gets the service application class definition.
|
protected MetadataServiceApp |
newMetadataServiceApp()
Creates a new service application.
|
boolean |
onAlert(Optional<Alert> alert)
Called on alert.
|
protected boolean |
onEvent(Event event)
Called when a event has been received.
|
protected boolean |
onNewMetadata(Metadata metadata)
Called on new metadata.
|
protected void |
onServicesNotReady()
Acts when some services are not ready.
|
protected boolean |
onSignal(Signal signal)
Called when a signal has been received.
|
protected boolean |
setUp()
Sets up the service thread.
|
protected void |
tearDown()
Tears down what has been set up.
|
getMetadata, hasMetadata, loadMetadata, monitorStores, reloadMetadata, resetPointsStore, tearDownConfig
addAlertListener, cancelRestarters, disableSuspend, doRun, enableSuspend, exportAgent, fail, getAlerter, getConfig, getDataDir, getJoinTimeout, getMutex, getOptionalSourceUUID, getServiceActivator, getServiceUUID, getSourceUUID, isJMXRegistrationEnabled, isRunning, isStarted, isStopped, isStopping, isWait, isZombie, monitorService, onServiceStartFailure, registerServer, removeAlertListener, restart, restoreConfigState, restoreMonitored, resume, run, saveConfigState, saveMonitored, sendAlert, sendEvent, sendSignal, setRestartEnabled, setRestartSignaled, setSourceUUID, starting, stopping, suspend, trySuspend, unregisterServer
addStats, closeSnoozeAlarm, getLogID, getServiceActivatorBase, getServiceName, getStats, getThisLogger, getThread, getTimer, getVersion, interrupt, isCurrentThread, isThreadStarted, join, logStats, scheduleMidnightLogger, setLogID, setServiceActivatorBase, setServiceName, snooze, starting, startThread, startTimer, stopping, stopTimer, toString, uncaughtException, updateStats, wakeUp
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAlertListener, disableSuspend, enableSuspend, exportAgent, getAlerter, getConfig, getDataDir, getJoinTimeout, getOptionalSourceUUID, getServiceActivator, getServiceUUID, getSourceUUID, isRunning, isStarted, isStopped, isStopping, isWait, isZombie, monitorService, registerServer, removeAlertListener, restart, restoreConfigState, restoreMonitored, resume, saveConfigState, saveMonitored, sendAlert, sendEvent, sendSignal, setRestartEnabled, setSourceUUID, starting, stopping, suspend, trySuspend, unregisterServer
addStats, fail, getServiceName, getStats, getTimer, isJMXRegistrationEnabled, snooze, starting, stopping, wakeUp
public static final String SERVICE_APP_CLASS_PROPERTY
public Optional<String> getEntityName()
getEntityName
in interface Service
getEntityName
in class ServiceImpl
public boolean onAlert(Optional<Alert> alert)
onAlert
in interface Alerter.Listener
onAlert
in class ServiceImpl
alert
- The alert (empty on failure).protected ServiceStats createStats(StatsOwner statsOwner)
createStats
in class ServiceImpl
statsOwner
- The stats owner.protected boolean doPendingActions() throws InterruptedException, ServiceNotAvailableException
Caution: this is called while synchronized on mutex.
doPendingActions
in class ServiceImpl
InterruptedException
- When the service is stopped.ServiceNotAvailableException
- When the service is not available.protected void doStart() throws Exception
doStart
in class ServiceImpl
Exception
- Handled by ServiceImpl.run()
.protected void doStop() throws Exception
doStop
in class ServiceImpl
Exception
- Handled by ServiceImpl.run()
.@Nonnull @CheckReturnValue protected MetadataServiceApp getMetadataServiceApp()
@Nullable @CheckReturnValue protected ClassDef getServiceAppClassDef()
@Nullable @CheckReturnValue protected MetadataServiceApp newMetadataServiceApp()
protected boolean onEvent(Event event)
Caution: this is called while synchronized on mutex.
onEvent
in class ServiceImpl
event
- The signal.protected boolean onNewMetadata(Metadata metadata)
onNewMetadata
in class MetadataServiceImpl
metadata
- The new metadata.protected void onServicesNotReady()
Caution: this is called while synchronized on mutex.
This is called by the pending actions processing when it not known if all registered services are ready. This may be used by a service thread to trigger some state refresh when the pending actions processing are completed; at that time, all the registered services will be ready.
onServicesNotReady
in class ServiceImpl
protected boolean onSignal(Signal signal)
Caution: this is called while synchronized on mutex.
onSignal
in class MetadataServiceImpl
signal
- The signal.protected boolean setUp()
Overriding subclasses must call this with success before proceeding.
setUp
in class ServiceImpl
protected void tearDown()
tearDown
in class MetadataServiceImpl
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.