This commit is contained in:
Redkale
2018-07-13 23:13:42 +08:00
parent 511a966ce5
commit 607fc8e45f
2 changed files with 3 additions and 3 deletions

View File

@@ -69,7 +69,7 @@ public abstract class DataSqlSource<DBChannel> extends AbstractService implement
public DataSqlSource(String unitName, URL persistxml, Properties readprop, Properties writeprop) {
final AtomicInteger counter = new AtomicInteger();
this.threads = Integer.decode(readprop.getProperty(JDBC_CONNECTIONSMAX, "" + Runtime.getRuntime().availableProcessors() * 16));
int maxconns = Math.max(8, Integer.decode(readprop.getProperty(JDBC_CONNECTIONSMAX, "" + Runtime.getRuntime().availableProcessors() * 16)));
int maxconns = Math.max(8, Integer.decode(readprop.getProperty(JDBC_CONNECTIONSMAX, "" + Runtime.getRuntime().availableProcessors() * 200)));
if (readprop != writeprop) {
this.threads += Integer.decode(writeprop.getProperty(JDBC_CONNECTIONSMAX, "" + Runtime.getRuntime().availableProcessors() * 16));
maxconns = 0;

View File

@@ -32,7 +32,7 @@ public abstract class PoolSource<DBChannel> {
protected final AtomicLong saveCounter = new AtomicLong();
protected final Semaphore semaphore;
protected final Logger logger;
protected final String rwtype; // "" 或 "read" 或 "write"
@@ -72,7 +72,7 @@ public abstract class PoolSource<DBChannel> {
this.connectTimeoutSeconds = Integer.decode(prop.getProperty(JDBC_CONNECTTIMEOUT_SECONDS, "3"));
this.readTimeoutSeconds = Integer.decode(prop.getProperty(JDBC_READTIMEOUT_SECONDS, "3"));
this.writeTimeoutSeconds = Integer.decode(prop.getProperty(JDBC_WRITETIMEOUT_SECONDS, "3"));
this.maxconns = Math.max(8, Integer.decode(prop.getProperty(JDBC_CONNECTIONSMAX, "" + Runtime.getRuntime().availableProcessors() * 16)));
this.maxconns = Math.max(8, Integer.decode(prop.getProperty(JDBC_CONNECTIONSMAX, "" + Runtime.getRuntime().availableProcessors() * 100)));
this.semaphore = new Semaphore(this.maxconns);
String dbtype0 = "";
{ //jdbc:mysql:// jdbc:microsoft:sqlserver:// 取://之前的到最后一个:之间的字符串