Package org.opennms.netmgt.daemon
Class AbstractServiceDaemon
- java.lang.Object
-
- org.opennms.netmgt.daemon.AbstractServiceDaemon
-
- All Implemented Interfaces:
Fiber,PausableFiber,SpringServiceDaemon,ServiceDaemon,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
Actiond,Alarmd,AsteriskGateway,Collectd,Correlator,Discovery,EnhancedLinkd,Eventd,EventTranslator,EventTranslator,JettyServer,Notifd,PassiveStatusd,PassiveStatusKeeper,Poller,Queued,RTCManager,Scriptd,SnmpPoller,Syslogd,Tl1d,Trapd,Vacuumd
public abstract class AbstractServiceDaemon extends Object implements ServiceDaemon, SpringServiceDaemon
Abstract AbstractServiceDaemon class.
- Author:
- Mathew Brozowski, DJ Gregor
-
-
Field Summary
-
Fields inherited from interface org.opennms.core.fiber.Fiber
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
-
Fields inherited from interface org.opennms.core.fiber.PausableFiber
PAUSE_PENDING, PAUSED, RESUME_PENDING
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractServiceDaemon(String name)Constructor for AbstractServiceDaemon.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidafterPropertiesSet()afterPropertiesSetvoiddestroy()Destroys the current service.StringgetName()getNameintgetStatus()getStatusStringgetStatusText()getStatusTextvoidinit()initprotected booleanisPaused()isPausedprotected booleanisRunning()isRunningprotected booleanisStarting()isStartingprotected abstract voidonInit()onInitprotected voidonPause()onPauseprotected voidonResume()onResumeprotected voidonStart()onStartprotected voidonStop()onStopvoidpause()pausevoidresume()resumeprotected voidsetStatus(int status)setStatusvoidstart()startStringstatus()Deprecated.UsegetStatusText()instead.voidstop()Stops the currently running service.protected voidwaitForStatus(int status)waitForStatusprotected voidwaitForStatus(int status, long timeout)waitForStatus
-
-
-
Method Detail
-
afterPropertiesSet
public final void afterPropertiesSet() throws ExceptionafterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception- if any.
-
onInit
protected abstract void onInit()
onInit
-
onPause
protected void onPause()
onPause
-
onResume
protected void onResume()
onResume
-
onStart
protected void onStart()
onStart
-
onStop
protected void onStop()
onStop
-
getName
public final String getName()
getName
-
setStatus
protected final void setStatus(int status)
setStatus
- Parameters:
status- a int.
-
waitForStatus
protected final void waitForStatus(int status, long timeout) throws InterruptedExceptionwaitForStatus
- Parameters:
status- a int.timeout- a long.- Throws:
InterruptedException- if any.
-
waitForStatus
protected final void waitForStatus(int status) throws InterruptedExceptionwaitForStatus
- Parameters:
status- a int.- Throws:
InterruptedException- if any.
-
getStatus
public int getStatus()
getStatus
-
getStatusText
public String getStatusText()
getStatusText
- Specified by:
getStatusTextin interfaceServiceDaemon- Returns:
- a
Stringobject.
-
status
public String status()
Deprecated.UsegetStatusText()instead. This field is only for backwards compatibility with JMX operations.status
- Returns:
- a
Stringobject.
-
isRunning
protected boolean isRunning()
isRunning
- Returns:
- a boolean.
-
isPaused
protected boolean isPaused()
isPaused
- Returns:
- a boolean.
-
isStarting
protected boolean isStarting()
isStarting
- Returns:
- a boolean.
-
init
public final void init()
init
-
pause
public final void pause()
pause
- Specified by:
pausein interfacePausableFiber
-
resume
public final void resume()
resume
- Specified by:
resumein interfacePausableFiber
-
start
public final void start()
start
- Specified by:
startin interfaceFiber- Specified by:
startin interfaceSpringServiceDaemon
-
stop
public final void stop()
Stops the currently running service. If the service is not running then the command is silently discarded.
-
destroy
public final void destroy()
Destroys the current service.- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
-