|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.Base
com.tangosol.net.DefaultCacheServer
public class DefaultCacheServer
DefaultCacheServer is a simple command line facility and convenience API that starts all services that are declared as requiring an "autostart" in the configurable factory XML descriptor.
DefaultCacheServer can also monitor services it started to ensure they exist. Monitoring services is enabled by default.
Nested Class Summary | |
---|---|
static class |
DefaultCacheServer.GarServer GarServer provides the functionality of DefaultCacheServer under the context of a GAR file. |
protected class |
DefaultCacheServer.ShutdownProcess ShutdownHook implementation. |
Field Summary | |
---|---|
static long |
DEFAULT_WAIT_MILLIS The default number of milliseconds between checks for service restart. |
protected boolean |
m_fServicesStarted Flag that indicates whether this instance of DefaultCacheServer has called start on the associated services. |
protected boolean |
m_fShutdown Flag that indicates whether of not the shutdown was initiated. |
protected ServiceMonitor |
m_serviceMon The ServiceMonitor used to monitor services. |
protected java.lang.Thread |
m_threadShutdown Shutdown hook thread. |
Constructor Summary | |
---|---|
DefaultCacheServer(ConfigurableCacheFactory factory) Construct a DefaultCacheServer using the provided factory. |
Method Summary | |
---|---|
protected static DefaultCacheServer |
ensureInstance(ConfigurableCacheFactory factory) Returns the DefaultCacheServer singleton, creating it if necessary. |
protected static DefaultCacheServer.GarServer |
ensureInstance(java.io.File fileGar, java.lang.String sAppName) Returns the DefaultCacheServer singleton, creating it if necessary. |
protected static ConfigurableCacheFactory |
getConfigurableCacheFactory() Gets a ConfigurableCacheFactory based on the default configuration. |
protected static DefaultCacheServer |
getInstance() Returns the DefaultCacheServer created by a previous invocation of ensureInstance(ConfigurableCacheFactory) . |
protected java.lang.String |
getServiceBanner(Cluster cluster) Create a list of running services in the given Cluster. |
protected java.lang.String |
getServiceName(XmlElement xmlScheme) Based on the provided XmlElement, which represents the caching scheme, determine the service name that will be used for the service. |
protected void |
handleEnsureServiceException(java.lang.RuntimeException e) Invoked if starting a service raises an exception. |
protected void |
initialStartServices(boolean fMonitor) Start the services. |
static void |
main(java.lang.String[] asArg) Entry point: start the cache server under two possible contexts: With a "coherence-cache-config.xsd" compliant configuration file. |
protected void |
monitorServices(long cWaitMillis) Check the ServiceMonitor status ensuring it is monitoring services and DefaultCacheServer has not been shutdown. |
protected void |
setUp(long cWaitMillis) Setup any necessary resources. |
static void |
shutdown() Shutdown the cache server. |
void |
shutdownServer() Shutdown the DefaultCacheServer. |
static java.util.List |
start() Start all services that are declared as requiring an "autostart" in the default configurable factory XML descriptor. |
static java.util.List |
start(ConfigurableCacheFactory factory) Start all services that are declared as requiring an "autostart" in the configurable factory XML descriptor. |
void |
startAndMonitor(long cWaitMillis) Start the cache server and check the service status periodically, restarting any stopped services. |
static void |
startDaemon() Deprecated. use startServerDaemon() instead |
protected static void |
startDaemon(DefaultCacheServer dcs) Start the provided cache server on a dedicated daemon thread. |
static void |
startDaemon(java.io.File fileGar) Deprecated. use startServerDaemon(File) instead |
static void |
startDaemon(java.io.File fileGar, java.lang.String sAppName) Deprecated. use startServerDaemon(File, String) instead |
void |
startDaemon(long cWaitMillis) Start the cache server and asynchronously check the service status periodically, restarting any services that have stopped. |
static DefaultCacheServer |
startServerDaemon() Start the cache server on a dedicated daemon thread. |
static DefaultCacheServer.GarServer |
startServerDaemon(java.io.File fileGar) Start the cache server on a dedicated daemon thread using the given File reference to a GAR. |
static DefaultCacheServer.GarServer |
startServerDaemon(java.io.File fileGar, java.lang.String sAppName) Start the cache server on a dedicated daemon thread using the given File reference to a GAR. |
java.util.List |
startServices() Start all services that are declared as requiring an "autostart" in the configurable factory XML descriptor. |
protected java.util.Map |
startServicesInternal() Starts the services marked with autostart returning a map of service name to the created service. |
protected java.util.Map |
startServicesInternal(boolean fMonitor) Starts the services marked with autostart returning a map of service name to the created service. |
protected void |
stopMonitoring() Ensures the DCS instance has shutdown and the associated ServiceMonitor is no longer monitoring services. |
void |
waitForServiceStart() Block the calling thread until DefaultCacheServer has called start on all associated services. |
Field Detail |
---|
public static final long DEFAULT_WAIT_MILLIS
protected volatile ServiceMonitor m_serviceMon
protected volatile boolean m_fShutdown
protected boolean m_fServicesStarted
initialStartServices(boolean)
protected java.lang.Thread m_threadShutdown
Constructor Detail |
---|
public DefaultCacheServer(ConfigurableCacheFactory factory)
factory
- the ConfigurableCacheFactoryMethod Detail |
---|
public void startAndMonitor(long cWaitMillis)
This method will block the calling thread.
cWaitMillis
- the number of milliseconds between checkspublic void startDaemon(long cWaitMillis)
cWaitMillis
- the number of milliseconds between checkspublic java.util.List startServices()
public void shutdownServer()
public void waitForServiceStart()
java.lang.IllegalStateException
- iff the services were not attempted to be started, which could be due to concurrent shutdownpublic static void shutdown()
public static void startDaemon()
startServerDaemon()
insteadpublic static void startDaemon(java.io.File fileGar)
startServerDaemon(File)
insteadfileGar
- file reference to either a GAR file or a directory containing the contents of the GARpublic static void startDaemon(java.io.File fileGar, java.lang.String sAppName)
startServerDaemon(File, String)
insteadfileGar
- file reference to either a GAR file or a directory containing the contents of the GARsAppName
- name to be used for the applicationpublic static DefaultCacheServer startServerDaemon()
DefaultCacheServer
startedpublic static DefaultCacheServer.GarServer startServerDaemon(java.io.File fileGar)
fileGar
- file reference to either a GAR file or a directory containing the contents of the GARDefaultCacheServer.GarServer
startedpublic static DefaultCacheServer.GarServer startServerDaemon(java.io.File fileGar, java.lang.String sAppName)
fileGar
- file reference to either a GAR file or a directory containing the contents of the GARsAppName
- name to be used for the applicationDefaultCacheServer.GarServer
startedpublic static void main(java.lang.String[] asArg)
Default configuration file is "coherence-cache-config.xml"; default keep alive interval is 5 sec.
Example: java -server -Xms512m -Xmx512m com.tangosol.net.DefaultCacheServer coherence-cache-config.xml 5 GAR Example: java -server -Xms512m -Xmx512m com.tangosol.net.DefaupltCacheServer my-application.gar MyGarApp 5
asArg
- the command line argumentspublic static java.util.List start()
public static java.util.List start(ConfigurableCacheFactory factory)
factory
- ConfigurableCacheFactory to useprotected void stopMonitoring()
protected java.util.Map startServicesInternal()
protected java.util.Map startServicesInternal(boolean fMonitor)
fMonitor
- whether to monitor the started services to ensure their existenceprotected java.lang.String getServiceName(XmlElement xmlScheme)
xmlScheme
- the caching scheme to derive a service name fromprotected void setUp(long cWaitMillis)
cWaitMillis
- the interval, in milliseconds, to monitor servicesprotected void initialStartServices(boolean fMonitor)
fMonitor
- whether the started services should be monitoredprotected void monitorServices(long cWaitMillis)
cWaitMillis
- the number of milliseconds between checksprotected void handleEnsureServiceException(java.lang.RuntimeException e)
e
- the RuntimeExceptionstartServices()
protected java.lang.String getServiceBanner(Cluster cluster)
cluster
- Cluster for which to create a list of running servicesprotected static void startDaemon(DefaultCacheServer dcs)
dcs
- the cache server to startprotected static ConfigurableCacheFactory getConfigurableCacheFactory()
protected static DefaultCacheServer ensureInstance(ConfigurableCacheFactory factory)
factory
- the CacheFactory to useprotected static DefaultCacheServer.GarServer ensureInstance(java.io.File fileGar, java.lang.String sAppName)
fileGar
- file reference to either a GAR file or a directory containing the contents of the GARsAppName
- application nameprotected static DefaultCacheServer getInstance()
ensureInstance(ConfigurableCacheFactory)
. Will throw an IllegalStateException if there is no instance. This is intended for use only by the static methods;
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |