/** * Creates a DelegatingComponentMonitor with a given delegate * @param delegate the ComponentMonitor to which this monitor delegates */ public DelegatingComponentMonitor(ComponentMonitor delegate) { checkMonitor(delegate); this.delegate = delegate; }
/** * If the delegate supports a {@link ComponentMonitorStrategy monitor strategy}, * this is used to changed the monitor while keeping the same delegate. * Else the delegate is replaced by the new monitor. * {@inheritDoc} */ public void changeMonitor(ComponentMonitor monitor) { checkMonitor(monitor); if ( delegate instanceof ComponentMonitorStrategy ){ ((ComponentMonitorStrategy)delegate).changeMonitor(monitor); } else { delegate = monitor; } }