Update of /var/cvs/src/org/mmbase/module/database
In directory james.mmbase.org:/tmp/cvs-serv26261
Modified Files:
JDBC.java
Log Message:
dont' set up all kind of stuff if it's not going to be used
See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/module/database
Index: JDBC.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/module/database/JDBC.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- JDBC.java 1 Aug 2008 21:12:52 -0000 1.60
+++ JDBC.java 1 Aug 2008 22:32:20 -0000 1.61
@@ -16,6 +16,7 @@
import org.mmbase.util.*;
import org.mmbase.module.*;
+import org.mmbase.module.core.MMBase;
import org.mmbase.util.logging.*;
@@ -27,7 +28,7 @@
*
* @deprecation-used drop reference to [EMAIL PROTECTED] JDBCInterface}
* @author vpro
- * @version $Id: JDBC.java,v 1.60 2008/08/01 21:12:52 michiel Exp $
+ * @version $Id: JDBC.java,v 1.61 2008/08/01 22:32:20 michiel Exp $
*/
public class JDBC extends ProcessorModule {
@@ -61,16 +62,22 @@
public void onload() {
getProps();
+ if (Module.getModule(MMBase.class, false).getDataSource() == null) {
getDriver();
loadSupport();
poolHandler = new MultiPoolHandler(databaseSupport, maxConnections,
maxQueries);
poolHandler.setMaxLifeTime(maxLifeTime);
+ } else {
+ log.service("Not setting up poolhandler, because we will use
data-source of application container");
+ }
}
/*
* Initialize the properties and get the driver used
*/
public void init() {
+ if (Module.getModule(MMBase.class, false).getDataSource() == null) {
+
future = ThreadPools.scheduler.scheduleAtFixedRate(new Runnable() {
public void run() {
JDBC.this.checkTime();
@@ -79,6 +86,9 @@
probeTime, probeTime, TimeUnit.MILLISECONDS);
log.info("Module JDBC started (" + this + ")");
ThreadPools.identify(future, "JDBC Probe");
+ } else {
+ log.service("Not setting up JDBC Probe, because we will use
data-source of application container");
+ }
}
@@ -103,8 +113,8 @@
public void unload() {
}
protected void shutdown() {
- future.cancel(true);
- poolHandler.shutdown();
+ if (future != null) future.cancel(true);
+ if (poolHandler != null) poolHandler.shutdown();
}
/**
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs