Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.net
Class DefaultCacheServer

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.net.DefaultCacheServer


public class DefaultCacheServer
extends Base

DefaultCacheServer is a simple command line facility that starts all services that are declared as requiring an "autostart" in the configurable factory XML descriptor.

Since:
Coherence 2.2
Author:
gg, yc

Nested Class Summary
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_fShutdown
          Flag that indicates whether of not the shutdown was initiated.
protected  java.lang.Thread m_threadShutdown
          Shutdown hook thread.

 

Constructor Summary
DefaultCacheServer(DefaultConfigurableCacheFactory factory)
          Construct a DefaultCacheServer using the provided factory.

 

Method Summary
protected  java.lang.String getServiceBanner(Cluster cluster)
          Create a list of running services in the given Cluster.
protected  void handleEnsureServiceException(java.lang.RuntimeException e)
          Invoked if starting a service raises an exception.
protected  void intialStartServices()
          Start the services.
static void main(java.lang.String[] asArg)
          Entry point: start the cache server using the specified path to the "cache-config.dtd" compliant configuration file and checking the service status every N seconds (keep alive interval).
protected  void monitorServices(long cWaitMillis)
          Check the service status periodically (keep alive interval), restarting any stopped services marked as "autostart".
protected  void setUp()
          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()
          Start the cache server on a dedicated daemon thread.
 java.util.List startServices()
          Start all services that are declared as requiring an "autostart" in the configurable factory XML descriptor.

 

Field Detail

DEFAULT_WAIT_MILLIS

public static final long DEFAULT_WAIT_MILLIS
The default number of milliseconds between checks for service restart.
See Also:
Constant Field Values

m_fShutdown

protected volatile boolean m_fShutdown
Flag that indicates whether of not the shutdown was initiated.

m_threadShutdown

protected java.lang.Thread m_threadShutdown
Shutdown hook thread.

Constructor Detail

DefaultCacheServer

public DefaultCacheServer(DefaultConfigurableCacheFactory factory)
Construct a DefaultCacheServer using the provided factory.
Parameters:
factory - the DefaultConfigurableCacheFactory

Method Detail

startAndMonitor

public void startAndMonitor(long cWaitMillis)
Start the cache server and check the service status periodically, restarting any stopped services.
Parameters:
cWaitMillis - the number of milliseconds between checks

startServices

public java.util.List startServices()
Start all services that are declared as requiring an "autostart" in the configurable factory XML descriptor.
Returns:
list of services that have been successfuly started

shutdownServer

public void shutdownServer()
Shutdown the DefaultCacheServer.

shutdown

public static void shutdown()
Shutdown the cache server.
Since:
Coherence 3.2

startDaemon

public static void startDaemon()
Start the cache server on a dedicated daemon thread. This method is intended to be used within managed containers.
Since:
Coherence 3.2

main

public static void main(java.lang.String[] asArg)
Entry point: start the cache server using the specified path to the "cache-config.dtd" compliant configuration file and checking the service status every N seconds (keep alive interval).

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
 
Parameters:
asArg - the command line arguments

start

public static java.util.List start()
Start all services that are declared as requiring an "autostart" in the default configurable factory XML descriptor.
Returns:
list of services that have been successfully started

start

public static java.util.List start(ConfigurableCacheFactory factory)
Start all services that are declared as requiring an "autostart" in the configurable factory XML descriptor.
Parameters:
factory - DefaultConfigurableCacheFactory to use
Returns:
list of services that have been successfully started

setUp

protected void setUp()
Setup any necessary resources.

intialStartServices

protected void intialStartServices()
Start the services. This will be done exactly once during startAndMonitor.

monitorServices

protected void monitorServices(long cWaitMillis)
Check the service status periodically (keep alive interval), restarting any stopped services marked as "autostart".
Parameters:
cWaitMillis - the number of milliseconds between checks

handleEnsureServiceException

protected void handleEnsureServiceException(java.lang.RuntimeException e)
Invoked if starting a service raises an exception. Re-throws the exception. Override, for example, to log the exception and continue starting services.
Parameters:
e - the RuntimeException
See Also:
startServices()

getServiceBanner

protected java.lang.String getServiceBanner(Cluster cluster)
Create a list of running services in the given Cluster.
Parameters:
cluster - Cluster for which to create a list of running services
Returns:
string containing listing of running services

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.