This commit is contained in:
Redkale
2018-05-06 07:50:50 +08:00
parent a168dab8c0
commit 7116f33a3a

View File

@@ -89,7 +89,7 @@ public abstract class DataSqlSource<DBChannel> extends AbstractService implement
t.setUncaughtExceptionHandler(ueh); t.setUncaughtExceptionHandler(ueh);
return t; return t;
}); });
final int bufferCapacity = Integer.decode(readprop.getProperty(JDBC_CONNECTIONSCAPACITY, "" + 16 * 1024)); final int bufferCapacity = Math.max(16 * 1024, Integer.decode(readprop.getProperty(JDBC_CONNECTIONSCAPACITY, "" + 16 * 1024)));
this.bufferPool = new ObjectPool<>(new AtomicLong(), new AtomicLong(), this.threads, this.bufferPool = new ObjectPool<>(new AtomicLong(), new AtomicLong(), this.threads,
(Object... params) -> ByteBuffer.allocateDirect(bufferCapacity), null, (e) -> { (Object... params) -> ByteBuffer.allocateDirect(bufferCapacity), null, (e) -> {
if (e == null || e.isReadOnly() || e.capacity() != bufferCapacity) return false; if (e == null || e.isReadOnly() || e.capacity() != bufferCapacity) return false;