From 57d0afc06424187a864f070b116cdd2eee5b2eaf Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Sun, 17 Aug 2008 15:41:59 +0000 Subject: [PATCH] Do not try to create connections at core startup git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@686619 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/solr/handler/dataimport/JdbcDataSource.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java index 0d0853032d9..7a068678da1 100644 --- a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java +++ b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java @@ -45,7 +45,7 @@ public class JdbcDataSource extends private Callable factory; - private long connLastUsed = System.currentTimeMillis(); + private long connLastUsed = 0; private Connection conn; @@ -61,12 +61,6 @@ public class JdbcDataSource extends convertType = Boolean.parseBoolean(o.toString()); createConnectionFactory(context, initProps); - try { - conn = factory.call(); - } catch (Exception e) { - throw new DataImportHandlerException(DataImportHandlerException.SEVERE, - "Unable to create database connection", e); - } String bsz = initProps.getProperty("batchSize"); if (bsz != null) { @@ -287,7 +281,7 @@ public class JdbcDataSource extends if (currTime - connLastUsed > CONN_TIME_OUT) { synchronized (this) { Connection tmpConn = factory.call(); - finalize(); + close(); connLastUsed = System.currentTimeMillis(); return conn = tmpConn; }