public abstract class ServiceActivator extends ServiceActivatorBase implements ServiceActivatorMBean
This class supports RVPF services implemented by a ServiceImpl
.
StatsHolder.UpdateNotification
NAME_ARG_PREFIX, OBJECT_NAME_PROPERTY
ACTIVATOR_CLASS_NAME_SUFFIX, DEFAULT_DOMAIN, DOMAIN_PROPERTY, NAME_KEY, STATS_UPDATE_TYPE, TYPE_KEY
Constructor and Description |
---|
ServiceActivator() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptMainArg(String arg)
Accepts a main argument.
|
void |
create()
Creates the service.
|
protected abstract ServiceImpl |
createServiceImpl()
Creates the service implementation.
|
protected ServiceImpl |
createServiceImpl(Class<? extends ServiceImpl> serviceImplClass)
Creates a service implementation.
|
protected ServiceImpl |
createServiceImpl(ClassDef classDef)
Creates a service implementation.
|
void |
destroy()
Destroys the service.
|
protected void |
export()
Allows a subclass to export the JMX agent.
|
Optional<Config> |
getConfig()
Gets the service config.
|
String |
getConfigURL()
Gets the Configuration URL.
|
Optional<String> |
getObjectVersion()
Gets the object's version.
|
Service |
getService()
Gets the service.
|
Optional<Stats> |
getStats()
Gets the stats.
|
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 |
isZombie()
Asks if the service is in a 'zombie' state.
|
void |
setConfigURL(String configURL)
Sets the configuration file specification.
|
void |
setWait(boolean wait)
Sets the wait indicator.
|
void |
start()
Starts the service.
|
void |
start(boolean wait)
Starts the service.
|
void |
stop()
Stops the service.
|
protected void |
tearDownStandAlone()
Tears down what has been set up in stand alone mode.
|
void |
updateStats()
Updates the stats.
|
created, destroyed, equals, getObjectName, getProperties, getProperty, getServer, getVersion, hashCode, postDeregister, postRegister, preDeregister, preRegister, restart, restart, run, setListener, setObjectNameProperty, setProperties, setProperty, started, starting, stopped, stopping, terminate, toString
getDefaultDomain, getStatsStrings, getThisLogger, makeObjectName, makeObjectName, objectName, onStatsUpdated, setObjectName
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
getProperties, getProperty, restart, setProperties, setProperty
getStatsStrings
public void create() throws Exception
create
in interface ServiceActivatorBaseMBean
create
in class ServiceActivatorBase
Exception
- As appropriate for the service.public void destroy()
destroy
in interface ServiceActivatorBaseMBean
destroy
in class ServiceActivatorBase
@Nonnull @CheckReturnValue public final Optional<Config> getConfig()
public final String getConfigURL()
getConfigURL
in interface ServiceActivatorMBean
public final Optional<String> getObjectVersion()
getObjectVersion
in interface StatsOwner
getObjectVersion
in class StatsHolder
@Nonnull @CheckReturnValue public final Service getService()
public final Optional<Stats> getStats()
getStats
in class ServiceActivatorBase
public final boolean isRunning()
isRunning
in interface ServiceActivatorBaseMBean
isRunning
in class ServiceActivatorBase
public final boolean isStarted()
isStarted
in interface ServiceActivatorBaseMBean
public final boolean isStopped()
isStopped
in interface ServiceActivatorBaseMBean
isStopped
in class ServiceActivatorBase
public final boolean isZombie()
isZombie
in interface ServiceActivatorMBean
public final void setConfigURL(String configURL)
setConfigURL
in interface ServiceActivatorMBean
configURL
- The configuration file specification.public final void setWait(boolean wait)
This provides the default value for start()
.
wait
- The wait indicator.public void start() throws Exception
start
in interface ServiceActivatorBaseMBean
start
in class ServiceActivatorBase
Exception
- As appropriate for the service.public final void start(boolean wait) throws Exception
wait
- True asks to wait until running.Exception
- As appropriate for the service.public void stop()
stop
in interface ServiceActivatorBaseMBean
stop
in class ServiceActivatorBase
public final void updateStats()
updateStats
in interface StatsOwner
updateStats
in class ServiceActivatorBase
protected boolean acceptMainArg(String arg)
acceptMainArg
in class ServiceActivatorBase
arg
- An argument for main args.@Nonnull @CheckReturnValue protected abstract ServiceImpl createServiceImpl()
This must be implemented by the subclasses to provide the actual service.
@Nonnull @CheckReturnValue protected final ServiceImpl createServiceImpl(@Nonnull Class<? extends ServiceImpl> serviceImplClass)
serviceImplClass
- The class of the service implementation.@Nullable @CheckReturnValue protected final ServiceImpl createServiceImpl(@Nonnull ClassDef classDef)
classDef
- The class definition for the service implementation.protected final void export()
export
in class ServiceActivatorBase
protected void tearDownStandAlone()
tearDownStandAlone
in class ServiceActivatorBase
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.