01: /*
02: * This software is released under a licence similar to the Apache Software Licence.
03: * See org.logicalcobwebs.proxool.package.html for details.
04: * The latest version is available at http://proxool.sourceforge.net
05: */
06: package org.logicalcobwebs.proxool;
07:
08: import java.util.Properties;
09:
10: import org.apache.commons.logging.Log;
11: import org.apache.commons.logging.LogFactory;
12: import org.logicalcobwebs.proxool.util.AbstractListenerContainer;
13:
14: /**
15: * A {@link ConfigurationListenerIF} that keeps a list of <code>ConfigurationListenerIF</code>s
16: * and notifies them in a thread safe manner.
17: * It also implements {@link org.logicalcobwebs.proxool.util.ListenerContainerIF ListenerContainerIF}
18: * which provides methods for
19: * {@link org.logicalcobwebs.proxool.util.ListenerContainerIF#addListener(Object) adding} and
20: * {@link org.logicalcobwebs.proxool.util.ListenerContainerIF#removeListener(Object) removing} listeners.
21: *
22: * @version $Revision: 1.7 $, $Date: 2006/01/18 14:40:01 $
23: * @author Christian Nedregaard (christian_nedregaard@email.com)
24: * @author $Author: billhorsman $ (current maintainer)
25: * @since Proxool 0.7
26: */
27: public class CompositeConfigurationListener extends
28: AbstractListenerContainer implements ConfigurationListenerIF {
29: static final Log LOG = LogFactory
30: .getLog(CompositeConfigurationListener.class);
31:
32: /**
33: * @see ConfigurationListenerIF#definitionUpdated(ConnectionPoolDefinitionIF, Properties, Properties)
34: */
35: public void definitionUpdated(
36: ConnectionPoolDefinitionIF connectionPoolDefinition,
37: Properties completeInfo, Properties changedInfo) {
38: Object[] listeners = getListeners();
39:
40: for (int i = 0; i < listeners.length; i++) {
41: try {
42: ConfigurationListenerIF configurationListener = (ConfigurationListenerIF) listeners[i];
43: configurationListener.definitionUpdated(
44: connectionPoolDefinition,
45: (Properties) completeInfo.clone(),
46: (Properties) changedInfo.clone());
47: } catch (RuntimeException re) {
48: LOG.warn("RuntimeException received from listener "
49: + listeners[i] + " when dispatching event", re);
50: }
51: }
52: }
53: }
54:
55: /*
56: Revision history:
57: $Log: CompositeConfigurationListener.java,v $
58: Revision 1.7 2006/01/18 14:40:01 billhorsman
59: Unbundled Jakarta's Commons Logging.
60:
61: Revision 1.6 2004/03/16 08:48:32 brenuart
62: Changes in the AbstractListenerContainer:
63: - provide more efficient concurrent handling;
64: - better handling of RuntimeException thrown by external listeners.
65:
66: Revision 1.5 2003/03/10 15:26:43 billhorsman
67: refactoringn of concurrency stuff (and some import
68: optimisation)
69:
70: Revision 1.4 2003/03/03 11:11:56 billhorsman
71: fixed licence
72:
73: Revision 1.3 2003/02/26 16:05:52 billhorsman
74: widespread changes caused by refactoring the way we
75: update and redefine pool definitions.
76:
77: Revision 1.2 2003/02/07 17:20:17 billhorsman
78: checkstyle
79:
80: Revision 1.1 2003/02/07 01:47:17 chr32
81: Initial revition.
82:
83: */
|