KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > proxool > CompositeConfigurationListener


1 /*
2  * This software is released under a licence similar to the Apache Software Licence.
3  * See org.logicalcobwebs.proxool.package.html for details.
4  * The latest version is available at http://proxool.sourceforge.net
5  */

6 package org.logicalcobwebs.proxool;
7
8 import java.util.Properties JavaDoc;
9
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 AbstractListenerContainer implements ConfigurationListenerIF {
28     static final Log LOG = LogFactory.getLog(CompositeConfigurationListener.class);
29
30     /**
31      * @see ConfigurationListenerIF#definitionUpdated(ConnectionPoolDefinitionIF, Properties, Properties)
32      */

33     public void definitionUpdated( ConnectionPoolDefinitionIF connectionPoolDefinition,
34                                    Properties JavaDoc completeInfo,
35                                    Properties JavaDoc changedInfo)
36     {
37         Object JavaDoc[] listeners = getListeners();
38             
39         for(int i=0; i<listeners.length; i++) {
40             try {
41                 ConfigurationListenerIF configurationListener = (ConfigurationListenerIF) listeners[i];
42                 configurationListener.definitionUpdated(connectionPoolDefinition, (Properties JavaDoc) completeInfo.clone(), (Properties JavaDoc) changedInfo.clone());
43             }
44             catch (RuntimeException JavaDoc re) {
45                 LOG.warn("RuntimeException received from listener "+listeners[i]+" when dispatching event", re);
46             }
47         }
48     }
49 }
50
51 /*
52  Revision history:
53  $Log: CompositeConfigurationListener.java,v $
54  Revision 1.7 2006/01/18 14:40:01 billhorsman
55  Unbundled Jakarta's Commons Logging.
56
57  Revision 1.6 2004/03/16 08:48:32 brenuart
58  Changes in the AbstractListenerContainer:
59  - provide more efficient concurrent handling;
60  - better handling of RuntimeException thrown by external listeners.
61
62  Revision 1.5 2003/03/10 15:26:43 billhorsman
63  refactoringn of concurrency stuff (and some import
64  optimisation)
65
66  Revision 1.4 2003/03/03 11:11:56 billhorsman
67  fixed licence
68
69  Revision 1.3 2003/02/26 16:05:52 billhorsman
70  widespread changes caused by refactoring the way we
71  update and redefine pool definitions.
72
73  Revision 1.2 2003/02/07 17:20:17 billhorsman
74  checkstyle
75
76  Revision 1.1 2003/02/07 01:47:17 chr32
77  Initial revition.
78
79 */
Popular Tags