org.apache.xbean.kernel.standard
Class ServiceMonitorBroadcaster

java.lang.Object
  extended by org.apache.xbean.kernel.standard.ServiceMonitorBroadcaster
All Implemented Interfaces:
ServiceMonitor

public class ServiceMonitorBroadcaster
extends Object
implements ServiceMonitor

The ServiceMonitorBroadcaster broadcasts kernel events to registered service monitors.

Since:
2.0
Author:
Dain Sundstrom

Constructor Summary
ServiceMonitorBroadcaster(KernelMonitor kernelMonitor)
          Creates a ServiceMonitorBroadcaster that notifies the specified kernel monitor when an error occurs while notifying the registered service monitors.
 
Method Summary
 void addServiceMonitor(ServiceMonitor serviceMonitor, ServiceName serviceName)
          Adds a service monitor for a specific service, or if the specified service name is null, a global monitor.
 void removeServiceMonitor(ServiceMonitor serviceMonitor)
          Removes a service monitor.
 void serviceRegistered(ServiceEvent serviceEvent)
          A new service has been registered with the kernel.
 void serviceRunning(ServiceEvent serviceEvent)
          A service has entered the RUNNING state.
 void serviceStartError(ServiceEvent serviceEvent)
          An error occured while calling creating the service.
 void serviceStarting(ServiceEvent serviceEvent)
          A service has entered the STARTING state.
 void serviceStopError(ServiceEvent serviceEvent)
          An error occured while calling destroying the service.
 void serviceStopped(ServiceEvent serviceEvent)
          A service has entered the STOPPED state.
 void serviceStopping(ServiceEvent serviceEvent)
          A service has entered the RUNNING state.
 void serviceUnregistered(ServiceEvent serviceEvent)
          A service has been unregistered from the kernel.
 void serviceWaitingToStart(ServiceEvent serviceEvent)
          A service is waiting to start because some start conditions are unsatified.
 void serviceWaitingToStop(ServiceEvent serviceEvent)
          A service is waiting to stop because some stop condition is unsatified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceMonitorBroadcaster

public ServiceMonitorBroadcaster(KernelMonitor kernelMonitor)
Creates a ServiceMonitorBroadcaster that notifies the specified kernel monitor when an error occurs while notifying the registered service monitors.

Parameters:
kernelMonitor - the monitor to notify when an error occurs while notifying the registered service monitors
Method Detail

addServiceMonitor

public void addServiceMonitor(ServiceMonitor serviceMonitor,
                              ServiceName serviceName)
Adds a service monitor for a specific service, or if the specified service name is null, a global monitor.

Note: the order in which service monitors are notified is not specified.

Parameters:
serviceMonitor - the service monitor to add
serviceName - the unique name of the service to monitor or null to monitor all services

removeServiceMonitor

public void removeServiceMonitor(ServiceMonitor serviceMonitor)
Removes a service monitor.

Parameters:
serviceMonitor - the service monitor to remove

serviceRegistered

public void serviceRegistered(ServiceEvent serviceEvent)
A new service has been registered with the kernel.

Specified by:
serviceRegistered in interface ServiceMonitor
Parameters:
serviceEvent - the event information

serviceStarting

public void serviceStarting(ServiceEvent serviceEvent)
A service has entered the STARTING state.

Specified by:
serviceStarting in interface ServiceMonitor
Parameters:
serviceEvent - the event information

serviceWaitingToStart

public void serviceWaitingToStart(ServiceEvent serviceEvent)
A service is waiting to start because some start conditions are unsatified.

Specified by:
serviceWaitingToStart in interface ServiceMonitor
Parameters:
serviceEvent - the event information
See Also:
ServiceEvent.getUnsatisfiedConditions()

serviceStartError

public void serviceStartError(ServiceEvent serviceEvent)
An error occured while calling creating the service.

Specified by:
serviceStartError in interface ServiceMonitor
Parameters:
serviceEvent - the event information
See Also:
ServiceEvent.getCause()

serviceRunning

public void serviceRunning(ServiceEvent serviceEvent)
A service has entered the RUNNING state.

Specified by:
serviceRunning in interface ServiceMonitor
Parameters:
serviceEvent - the event information

serviceStopping

public void serviceStopping(ServiceEvent serviceEvent)
A service has entered the RUNNING state.

Specified by:
serviceStopping in interface ServiceMonitor
Parameters:
serviceEvent - the event information

serviceWaitingToStop

public void serviceWaitingToStop(ServiceEvent serviceEvent)
A service is waiting to stop because some stop condition is unsatified.

Specified by:
serviceWaitingToStop in interface ServiceMonitor
Parameters:
serviceEvent - the event information
See Also:
ServiceEvent.getUnsatisfiedConditions()

serviceStopError

public void serviceStopError(ServiceEvent serviceEvent)
An error occured while calling destroying the service.

Specified by:
serviceStopError in interface ServiceMonitor
Parameters:
serviceEvent - the event information
See Also:
ServiceEvent.getCause()

serviceStopped

public void serviceStopped(ServiceEvent serviceEvent)
A service has entered the STOPPED state.

Specified by:
serviceStopped in interface ServiceMonitor
Parameters:
serviceEvent - the event information

serviceUnregistered

public void serviceUnregistered(ServiceEvent serviceEvent)
A service has been unregistered from the kernel.

Specified by:
serviceUnregistered in interface ServiceMonitor
Parameters:
serviceEvent - the event information


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.