org.ops4j.monitors.exception
Class ExceptionMonitorRouter

java.lang.Object
  extended by org.ops4j.monitors.exception.ExceptionMonitorRouter
All Implemented Interfaces:
ExceptionMonitor, ExceptionSource

public class ExceptionMonitorRouter
extends Object
implements ExceptionMonitor, ExceptionSource

A monitor of a Exceptions occuring, and capability to route/delegate these events to 0..n registered ExceptionMonitor implementations.

The purpose of this class is to support that many monitors are registered to the same Exception source.

Version:
$Id$
Author:
Open Particpation Software for Java

Constructor Summary
ExceptionMonitorRouter()
          Creation of a exception monitor router.
 
Method Summary
 void exception(ExceptionSource source, Throwable exception)
          This method is called when an Exception or Throwable occurs.
 List<ExceptionMonitor> getExceptionMonitors()
          Returns all ExceptionMonitors that are registered.
 ExceptionMonitor getMonitor(int index)
          Returns the ExceptionMonitor at a particular index.
 void registerExceptionMonitor(ExceptionMonitor monitor)
          Add a monitor to the list of monitors managed by this router.
 int size()
          Returns the number of registered ExceptionMonitors.
 void unregisterExceptionMonitor(ExceptionMonitor monitor)
          Remove a monitor to the list of monitors managed by this router.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionMonitorRouter

public ExceptionMonitorRouter()
Creation of a exception monitor router.

Method Detail

exception

public void exception(ExceptionSource source,
                      Throwable exception)
This method is called when an Exception or Throwable occurs.

Specified by:
exception in interface ExceptionMonitor
Parameters:
source - The source of the Exception.
exception - The Exception being thrown.

registerExceptionMonitor

public void registerExceptionMonitor(ExceptionMonitor monitor)
Add a monitor to the list of monitors managed by this router.

Specified by:
registerExceptionMonitor in interface ExceptionSource
Parameters:
monitor - the monitor to add

unregisterExceptionMonitor

public void unregisterExceptionMonitor(ExceptionMonitor monitor)
Remove a monitor to the list of monitors managed by this router.

Specified by:
unregisterExceptionMonitor in interface ExceptionSource
Parameters:
monitor - the monitor to add

getExceptionMonitors

public List<ExceptionMonitor> getExceptionMonitors()
Returns all ExceptionMonitors that are registered.

Specified by:
getExceptionMonitors in interface ExceptionSource
Returns:
all ExceptionMonitors that are registered.

size

public int size()
Returns the number of registered ExceptionMonitors.

Returns:
The number of ExceptionMonitors that this router handles.

getMonitor

public ExceptionMonitor getMonitor(int index)
Returns the ExceptionMonitor at a particular index.

Parameters:
index - which monitor in the current list to return.
Returns:
The requested monitor.


Copyright © 2006-2013 OPS4J - Open Participation Software for Java. All Rights Reserved.