mirror of https://github.com/apache/lucene.git
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
This commit is contained in:
parent
0cbe7af081
commit
57d0afc064
|
@ -45,7 +45,7 @@ public class JdbcDataSource extends
|
||||||
|
|
||||||
private Callable<Connection> factory;
|
private Callable<Connection> factory;
|
||||||
|
|
||||||
private long connLastUsed = System.currentTimeMillis();
|
private long connLastUsed = 0;
|
||||||
|
|
||||||
private Connection conn;
|
private Connection conn;
|
||||||
|
|
||||||
|
@ -61,12 +61,6 @@ public class JdbcDataSource extends
|
||||||
convertType = Boolean.parseBoolean(o.toString());
|
convertType = Boolean.parseBoolean(o.toString());
|
||||||
|
|
||||||
createConnectionFactory(context, initProps);
|
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");
|
String bsz = initProps.getProperty("batchSize");
|
||||||
if (bsz != null) {
|
if (bsz != null) {
|
||||||
|
@ -287,7 +281,7 @@ public class JdbcDataSource extends
|
||||||
if (currTime - connLastUsed > CONN_TIME_OUT) {
|
if (currTime - connLastUsed > CONN_TIME_OUT) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
Connection tmpConn = factory.call();
|
Connection tmpConn = factory.call();
|
||||||
finalize();
|
close();
|
||||||
connLastUsed = System.currentTimeMillis();
|
connLastUsed = System.currentTimeMillis();
|
||||||
return conn = tmpConn;
|
return conn = tmpConn;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue