Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


com.tangosol.net
Class SimpleServiceMonitor

java.lang.Object
  extended by com.tangosol.net.SimpleServiceMonitor

All Implemented Interfaces:
com.oracle.common.base.Disposable, ServiceMonitor

public class SimpleServiceMonitor
extends java.lang.Object
implements ServiceMonitor

The SimpleServiceMonitor starts and monitors services that are registered for monitoring.

Since:
Coherence 12.1.2
Author:
cf 2011.05.24, hr 2012.06.28

Field Summary
protected static java.lang.Integer DEFAULT_WAIT_MILLIS
          The default time interval by which we check the alive status.
protected  ConfigurableCacheFactory m_ccf
          ConfigurableCacheFactory instance used to start the service.
protected  long m_cWaitMillis
          The number of milliseconds between checking the status of the services.
protected  boolean m_fDisposed
          Indicates that this ServiceMonitor has been disposed.
protected  boolean m_fStarted
          Indicates that the ServiceMonitor has started.
protected  java.util.Map m_mapServicesByName
          A map of Services by service name to be monitored.
protected  java.lang.Thread m_thread
          The Thread we are using for monitoring the services periodically.

 

Constructor Summary
SimpleServiceMonitor()
          Construct a SimpleServiceMonitor with the default interval to check that the registered services are running ().
SimpleServiceMonitor(long cWaitMillis)
          Construct a SimpleServiceMonitor with the provided interval to check that the registered services are running.

 

Method Summary
protected  void assertNotDisposed()
          Throws IllegalStateException if this monitor has been disposed via invocation of dispose().
 void dispose()
          
protected  boolean isDisposed()
          Return true if this ServiceMonitor has been disposed via invocation of dispose().
 boolean isMonitoring()
          Returns true iff the ServiceMonitor is monitoring a number of services.
protected  void monitorServices(long cWaitMillis)
          Check the service status periodically (keep alive interval), restarting any stopped services.
 void registerServices(java.util.Map mapServices)
          Adds a set of Services to be monitored providing life support.
 void setConfigurableCacheFactory(ConfigurableCacheFactory ccf)
          Set the ConfigurableCacheFactory a ServiceMonitor can operate with.
protected  void start()
          Start monitoring the services.
 void stopMonitoring()
          Stop monitoring all registered services.
 void unregisterServices(java.util.Set setServices)
          Removes the supplied set of Services from monitoring.

 

Field Detail

DEFAULT_WAIT_MILLIS

protected static final java.lang.Integer DEFAULT_WAIT_MILLIS
The default time interval by which we check the alive status.

m_fStarted

protected volatile boolean m_fStarted
Indicates that the ServiceMonitor has started.

m_thread

protected java.lang.Thread m_thread
The Thread we are using for monitoring the services periodically.

m_fDisposed

protected boolean m_fDisposed
Indicates that this ServiceMonitor has been disposed.

m_ccf

protected ConfigurableCacheFactory m_ccf
ConfigurableCacheFactory instance used to start the service.

m_mapServicesByName

protected java.util.Map m_mapServicesByName
A map of Services by service name to be monitored.

m_cWaitMillis

protected final long m_cWaitMillis
The number of milliseconds between checking the status of the services.

Constructor Detail

SimpleServiceMonitor

public SimpleServiceMonitor()
Construct a SimpleServiceMonitor with the default interval to check that the registered services are running ().

SimpleServiceMonitor

public SimpleServiceMonitor(long cWaitMillis)
Construct a SimpleServiceMonitor with the provided interval to check that the registered services are running.
Parameters:
cWaitMillis - the number of milliseconds in between checking that the registered services are running

Method Detail

registerServices

public void registerServices(java.util.Map mapServices)
Adds a set of Services to be monitored providing life support. If any of the services are not running they are started either via the configured ConfigurableCacheFactory iff provided or the provided Service.
Specified by:
registerServices in interface ServiceMonitor
Parameters:
mapServices - a map of Services by service name

unregisterServices

public void unregisterServices(java.util.Set setServices)
Removes the supplied set of Services from monitoring. Note that the services are not being stopped; they are just removed from the list of Services that are being monitored.
Specified by:
unregisterServices in interface ServiceMonitor
Parameters:
setServices - the set of Services to be removed from monitoring

stopMonitoring

public void stopMonitoring()
Stop monitoring all registered services. Note that the services are not being stopped; they are just removed from the list of Services that are being monitored.
Specified by:
stopMonitoring in interface ServiceMonitor

isMonitoring

public boolean isMonitoring()
Returns true iff the ServiceMonitor is monitoring a number of services.
Specified by:
isMonitoring in interface ServiceMonitor
Returns:
returns true iff the ServiceMonitor is monitoring a number of services

setConfigurableCacheFactory

public void setConfigurableCacheFactory(ConfigurableCacheFactory ccf)
Set the ConfigurableCacheFactory a ServiceMonitor can operate with. Setting the ConfigurableCacheFactory should be performed prior to registering services or requires a ServiceMonitor.stopMonitoring() and ServiceMonitor.registerServices(Map) call.
Specified by:
setConfigurableCacheFactory in interface ServiceMonitor
Parameters:
ccf - the ConfigurableCacheFactory used to start the service

dispose

public void dispose()
Specified by:
dispose in interface com.oracle.common.base.Disposable

start

protected void start()
Start monitoring the services.

monitorServices

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

isDisposed

protected boolean isDisposed()
Return true if this ServiceMonitor has been disposed via invocation of dispose().
Returns:
true if this monitor has been disposed

assertNotDisposed

protected void assertNotDisposed()
Throws IllegalStateException if this monitor has been disposed via invocation of dispose().
Throws:
java.lang.IllegalStateException - if this monitor has been disposed

Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


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