Commit 84b6fd03 authored by Quxl's avatar Quxl

x

parent fb7e0f8f
......@@ -185,8 +185,26 @@ public class SqlConcurrentController {
dataSource.setDriverClassName(driverClass);
dataSource.setUsername(username);
dataSource.setPassword(password);
dataSource.setValidationQuery("select 1");
dataSource.setValidationQueryTimeout(1000);
dataSource.init();
int count = 5;
while(!dataSource.isInited() && count-- > 0) {
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if(dataSource.isInited()) {
return dataSource;
} else {
dataSource.close();
return null;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment