Update of /var/cvs/src/org/mmbase/core/event
In directory james.mmbase.org:/tmp/cvs-serv7282
Modified Files:
EventManager.java
Log Message:
added try/catch in inner loop to be more robust. Remoed instantation code, and
depedn on Instantiator
See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/core/event
Index: EventManager.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/core/event/EventManager.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- EventManager.java 18 Sep 2007 12:04:05 -0000 1.25
+++ EventManager.java 28 Jul 2008 13:06:21 -0000 1.26
@@ -28,7 +28,7 @@
*
* @author Ernst Bunders
* @since MMBase-1.8
- * @version $Id: EventManager.java,v 1.25 2007/09/18 12:04:05 michiel Exp $
+ * @version $Id: EventManager.java,v 1.26 2008/07/28 13:06:21 michiel Exp $
*/
public class EventManager {
@@ -62,22 +62,6 @@
return eventManager;
}
- private static EventBroker findInstance(String className) {
- if (className == null || "".equals(className)) return null;
- try {
- Class<?> aClass = Class.forName(className);
- return (EventBroker) aClass.newInstance();
- } catch (ClassNotFoundException e) {
- log.error("could not find class with name '" + className + "'", e);
- } catch (InstantiationException e) {
- log.error("could not instantiate class with name '" + className +
"'", e);
- } catch (IllegalAccessException e) {
- log.error("the constructor of '" + className + "' is not
accessible", e);
- } catch (ClassCastException e) {
- log.error("'" + className + "' is not a AbstractEventBroker", e);
- }
- return null;
- }
protected ResourceWatcher watcher = new ResourceWatcher() {
public void onChange(String w) {
@@ -104,14 +88,17 @@
// find the event brokers
for (Element element:
configReader.getChildElements("eventmanager.brokers", "broker")) {
- String className = element.getAttribute("class");
- EventBroker broker = findInstance(className);
+ try {
+ EventBroker broker =
Instantiator.getInstance(element);
if (broker != null) {
if (log.isDebugEnabled()) {
log.debug("adding event broker: " + broker);
}
addEventBroker(broker);
}
+ } catch (Throwable ee) {
+ log.warn(ee.getMessage(), ee);
+ }
}
}
} catch (SAXException e1) {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs