mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved WebURIStat & Proxy.
This commit is contained in:
@@ -108,7 +108,10 @@ public class PreparedStatementProxyImpl extends StatementProxyImpl implements Pr
|
||||
parametersSize = jdbcIndex;
|
||||
}
|
||||
if (parametersSize >= parameters.length) {
|
||||
parameters = Arrays.copyOf(parameters, parametersSize + 16);
|
||||
int oldCapacity = parameters.length;
|
||||
int newCapacity = oldCapacity + (oldCapacity >> 1);
|
||||
|
||||
parameters = Arrays.copyOf(parameters, newCapacity);
|
||||
}
|
||||
parameters[index] = parameter;
|
||||
|
||||
|
||||
@@ -178,9 +178,9 @@ public class WebURIStat {
|
||||
requestTimeNanoUpdater.addAndGet(this, nanos);
|
||||
|
||||
for (;;) {
|
||||
long current = requestTimeNanoUpdater.get(this);
|
||||
long current = requestTimeNanoMaxUpdater.get(this);
|
||||
if (current < nanos) {
|
||||
if (requestTimeNanoUpdater.compareAndSet(this, current, nanos)) {
|
||||
if (requestTimeNanoMaxUpdater.compareAndSet(this, current, nanos)) {
|
||||
// 可能不准确,但是绝大多数情况下都会正确,性能换取一致性
|
||||
requestTimeNanoMaxOccurTime = System.currentTimeMillis();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user