public class DiffusionServer extends Object implements EmbeddedDiffusion
getConfig()
and then configuring any aspects that are required.
Once the server has been started then most aspects of the configuration can
no longer be changed.
Currently only one instance of the Diffusion Server can ever be instantiated
in a VM. Once one has been instantiated another can not be. Once a server has
been stopped it may not be restarted nor another instantiated. These
restrictions may be removed at a future release.EmbeddedDiffusion.LifecycleListener, EmbeddedDiffusion.State
Constructor and Description |
---|
DiffusionServer()
Constructor.
|
DiffusionServer(Properties bootstrapProps)
Constructor.
|
DiffusionServer(Properties bootstrapProps,
boolean embedded)
Constructor.
|
DiffusionServer(String propertiesDirectory,
boolean embedded)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addLifecycleListener(EmbeddedDiffusion.LifecycleListener callback)
Register for lifecycle events.
|
ServerConfig |
getConfig()
Returns the root server configuration.
|
boolean |
isStarted() |
boolean |
isStopped() |
static void |
main(String... args)
This can be invoked to run free standing.
|
void |
removeLifecycleListener(EmbeddedDiffusion.LifecycleListener callback)
De-Register for lifecycle events.
|
void |
start()
Starts the server.
|
void |
stop()
Stops the server.
|
public DiffusionServer() throws ConfigException
DiffusionServer(Properties)
with the system
properties.ConfigException
- If the configuration is invalid.public DiffusionServer(Properties bootstrapProps) throws ConfigException
bootstrapProps
- The bootstrap properties to be used for configurationConfigException
- If the configuration is invalid.public DiffusionServer(String propertiesDirectory, boolean embedded) throws ConfigException
propertiesDirectory
- The properties directory from which xml
properties will be loaded. If null
, the default directory
will be used.embedded
- If true
, do not register a JVM shutdown hook, and
do not exit the JVM after stopping.ConfigException
- If the configuration is invalid.public DiffusionServer(Properties bootstrapProps, boolean embedded) throws ConfigException
bootstrapProps
- The bootstrap properties to be used for configurationembedded
- If true
, do not register a JVM shutdown hook, and
do not exit the JVM after stopping.ConfigException
- If the configuration is invalid.public final ServerConfig getConfig()
EmbeddedDiffusion
getConfig
in interface EmbeddedDiffusion
public boolean isStarted()
isStarted
in interface EmbeddedDiffusion
public boolean isStopped()
isStopped
in interface EmbeddedDiffusion
public void start() throws APIException
start
in interface EmbeddedDiffusion
APIException
- if embedded and unable to start; if not embedded
(see DiffusionServer(Properties, boolean)
), the JVM will exitpublic void stop()
DiffusionServer(Properties, boolean)
), the
JVM will exit.stop
in interface EmbeddedDiffusion
public void addLifecycleListener(EmbeddedDiffusion.LifecycleListener callback)
EmbeddedDiffusion
addLifecycleListener
in interface EmbeddedDiffusion
callback
- that is called when a state transition occurs.public void removeLifecycleListener(EmbeddedDiffusion.LifecycleListener callback)
EmbeddedDiffusion
removeLifecycleListener
in interface EmbeddedDiffusion
callback
- to be removed.public static void main(String... args) throws Throwable
args
- the first argument may be used to specify the location of the
properties directory from which XML property files will be loaded.
If not specified then they are loaded from the classpath.Throwable
- not expected - failures should cause the JVM to exitCopyright © 2022 Push Technology Ltd. All Rights Reserved.