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 protected
AbstractServiceDaemon(String name)
Constructor for AbstractServiceDaemon.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
afterPropertiesSet()
afterPropertiesSetvoid
destroy()
Destroys the current service.String
getName()
getNameint
getStatus()
getStatusString
getStatusText()
getStatusTextvoid
init()
initprotected boolean
isPaused()
isPausedprotected boolean
isRunning()
isRunningprotected boolean
isStarting()
isStartingprotected abstract void
onInit()
onInitprotected void
onPause()
onPauseprotected void
onResume()
onResumeprotected void
onStart()
onStartprotected void
onStop()
onStopvoid
pause()
pausevoid
resume()
resumeprotected void
setStatus(int status)
setStatusvoid
start()
startString
status()
Deprecated.UsegetStatusText()
instead.void
stop()
Stops the currently running service.protected void
waitForStatus(int status)
waitForStatusprotected void
waitForStatus(int status, long timeout)
waitForStatus
-
-
-
Method Detail
-
afterPropertiesSet
public final void afterPropertiesSet() throws Exception
afterPropertiesSet
- Specified by:
afterPropertiesSet
in 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 InterruptedException
waitForStatus
- Parameters:
status
- a int.timeout
- a long.- Throws:
InterruptedException
- if any.
-
waitForStatus
protected final void waitForStatus(int status) throws InterruptedException
waitForStatus
- Parameters:
status
- a int.- Throws:
InterruptedException
- if any.
-
getStatus
public int getStatus()
getStatus
-
getStatusText
public String getStatusText()
getStatusText
- Specified by:
getStatusText
in interfaceServiceDaemon
- Returns:
- a
String
object.
-
status
public String status()
Deprecated.UsegetStatusText()
instead. This field is only for backwards compatibility with JMX operations.status
- Returns:
- a
String
object.
-
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:
pause
in interfacePausableFiber
-
resume
public final void resume()
resume
- Specified by:
resume
in interfacePausableFiber
-
start
public final void start()
start
- Specified by:
start
in interfaceFiber
- Specified by:
start
in 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:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
-
-