@ThreadSafe public abstract class ServiceActivatorBase extends StatsHolder implements ServiceActivatorBaseMBean, MBeanRegistration
StatsHolder.UpdateNotification| Modifier and Type | Field and Description |
|---|---|
static String |
NAME_ARG_PREFIX
Name argument prefix property.
|
static String |
OBJECT_NAME_PROPERTY
JMX object name property.
|
ACTIVATOR_CLASS_NAME_SUFFIX, DEFAULT_DOMAIN, DOMAIN_PROPERTY, NAME_KEY, STATS_UPDATE_TYPE, TYPE_KEY| Constructor and Description |
|---|
ServiceActivatorBase() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
acceptMainArg(String arg)
Accepts a main argument.
|
void |
create()
Creates the service.
|
protected void |
created()
Completes the 'create' processing.
|
void |
destroy()
Destroys the service.
|
protected void |
destroyed()
Completes the 'destroy' processing.
|
boolean |
equals(Object other) |
protected void |
export()
Allows a subclass to export the JMX agent.
|
ObjectName |
getObjectName()
Gets the object name.
|
Properties |
getProperties()
Gets the MBean properties.
|
Optional<String> |
getProperty(String key)
Gets the value of a property.
|
protected MBeanServer |
getServer()
Gets the MBean server instance.
|
Optional<? extends Stats> |
getStats()
Gets the stats.
|
Version |
getVersion()
Gets the version object.
|
int |
hashCode() |
boolean |
isRunning()
Asks if the service is running.
|
boolean |
isStopped()
Asks if the service has been stopped.
|
void |
postDeregister() |
void |
postRegister(Boolean done) |
void |
preDeregister() |
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
This implementation saves the MBeanServer reference for possible use
by subclasses.
|
void |
restart()
Restarts the service.
|
void |
restart(Optional<ElapsedTime> delay)
Restarts the service.
|
protected void |
run(String[] args)
Runs the service.
|
void |
setListener(ServiceActivatorListener listener)
Sets the service listener.
|
void |
setObjectNameProperty(Optional<String> propertyName)
Sets the object name property.
|
void |
setProperties(Properties properties)
Sets the MBean properties.
|
void |
setProperty(String key,
String value)
Sets a property.
|
void |
start()
Starts the service.
|
protected void |
started()
Completes the 'start' processing.
|
void |
starting(Optional<ElapsedTime> waitHint)
Informs that the start is progressing.
|
void |
stop()
Stops the service.
|
protected void |
stopped()
Completes the 'stop' processing.
|
void |
stopping(Optional<ElapsedTime> waitHint)
Informs that the stop is progressing.
|
protected void |
tearDownStandAlone()
Tears down what has been set up in stand alone mode.
|
void |
terminate()
Terminates the service.
|
String |
toString() |
void |
updateStats()
Updates the stats.
|
getDefaultDomain, getObjectVersion, getStatsStrings, getThisLogger, makeObjectName, makeObjectName, objectName, onStatsUpdated, setObjectNameaddNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotificationisStartedgetStatsStringspublic static final String NAME_ARG_PREFIX
public static final String OBJECT_NAME_PROPERTY
public void create()
throws Exception
create in interface ServiceActivatorBaseMBeanException - As appropriate for the service.public void destroy()
destroy in interface ServiceActivatorBaseMBeanpublic final boolean equals(Object other)
equals in class Objectpublic final ObjectName getObjectName()
getObjectName in interface StatsOwnergetObjectName in class StatsHolderpublic final Properties getProperties()
getProperties in interface ServiceActivatorBaseMBeanpublic final Optional<String> getProperty(String key)
getProperty in interface ServiceActivatorBaseMBeankey - The name of the property.public Optional<? extends Stats> getStats()
getStats in class StatsHolder@Nonnull @CheckReturnValue public Version getVersion()
public final int hashCode()
hashCode in class Objectpublic boolean isRunning()
isRunning in interface ServiceActivatorBaseMBeanpublic boolean isStopped()
isStopped in interface ServiceActivatorBaseMBeanpublic final void postDeregister()
postDeregister in interface MBeanRegistrationpublic final void postRegister(Boolean done)
postRegister in interface MBeanRegistrationpublic final void preDeregister()
preDeregister in interface MBeanRegistrationpublic final ObjectName preRegister(MBeanServer server,
ObjectName name)
throws Exception
This implementation saves the MBeanServer reference for possible use by subclasses. It also supplies a default name if none is given.
preRegister in interface MBeanRegistrationExceptionpublic void restart()
throws Exception
restart in interface ServiceActivatorBaseMBeanException - As appropriate for the service.public final void restart(@Nonnull
Optional<ElapsedTime> delay)
throws Exception
delay - An optional number of milliseconds to wait between the stop
and the restart.Exception - As appropriate for the service.public final void setListener(@Nonnull
ServiceActivatorListener listener)
listener - The service listener.public final void setObjectNameProperty(@Nonnull
Optional<String> propertyName)
propertyName - The optional object name property.public final void setProperties(Properties properties)
setProperties in interface ServiceActivatorBaseMBeanproperties - The MBean properties.public final void setProperty(String key,
String value)
setProperty in interface ServiceActivatorBaseMBeankey - The name of the property.value - The value of the property.public void start()
throws Exception
start in interface ServiceActivatorBaseMBeanException - As appropriate for the service.public final void starting(@Nonnull
Optional<ElapsedTime> waitHint)
waitHint - An optional dditional time in milliseconds.public void stop()
stop in interface ServiceActivatorBaseMBeanpublic final void stopping(@Nonnull
Optional<ElapsedTime> waitHint)
waitHint - An optional additional elapsed time.public void terminate()
This is called by the service implementation or one of its children when an unexpected condition is detected.
public final String toString()
toString in class Objectpublic void updateStats()
updateStats in interface StatsOwnerupdateStats in class StatsHolder@CheckReturnValue
protected boolean acceptMainArg(@Nonnull
String arg)
arg - An argument for main args.protected void created()
protected void destroyed()
protected void export()
@Nonnull @CheckReturnValue protected final MBeanServer getServer()
protected final void run(@Nonnull
String[] args)
args - The program arguments.protected void started()
protected void stopped()
protected void tearDownStandAlone()
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.