ProtocolCodec优化
This commit is contained in:
@@ -33,7 +33,7 @@ public abstract class DispatcherServlet<K extends Serializable, C extends Contex
|
||||
|
||||
private final LongAdder executeCounter = new LongAdder(); //执行请求次数
|
||||
|
||||
private final LongAdder illRequestCounter = new LongAdder(); //错误请求次数
|
||||
private final LongAdder illegalRequestCounter = new LongAdder(); //错误请求次数
|
||||
|
||||
private final Object servletLock = new Object();
|
||||
|
||||
@@ -53,8 +53,8 @@ public abstract class DispatcherServlet<K extends Serializable, C extends Contex
|
||||
executeCounter.increment();
|
||||
}
|
||||
|
||||
protected void incrIllRequestCounter() {
|
||||
illRequestCounter.increment();
|
||||
protected void incrIllegalRequestCounter() {
|
||||
illegalRequestCounter.increment();
|
||||
}
|
||||
|
||||
protected void putServlet(S servlet) {
|
||||
@@ -279,7 +279,7 @@ public abstract class DispatcherServlet<K extends Serializable, C extends Contex
|
||||
}
|
||||
|
||||
public Long getIllRequestCounter() {
|
||||
return illRequestCounter.longValue();
|
||||
return illegalRequestCounter.longValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.function.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* 一个AsyncConnection绑定一个ProtocolCodec实例
|
||||
* 一个AsyncConnection绑定一个ProtocolCodec实例, 只会在读IOThread中运行
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@@ -146,7 +146,7 @@ class ProtocolCodec implements CompletionHandler<Integer, ByteBuffer> {
|
||||
preparer.incrExecuteCounter();
|
||||
channel.offerReadBuffer(buffer);
|
||||
if (rs != Integer.MIN_VALUE) {
|
||||
preparer.incrIllRequestCounter();
|
||||
preparer.incrIllegalRequestCounter();
|
||||
}
|
||||
response.finish(true);
|
||||
if (context.logger.isLoggable(Level.FINEST)) {
|
||||
@@ -197,7 +197,7 @@ class ProtocolCodec implements CompletionHandler<Integer, ByteBuffer> {
|
||||
|
||||
@Override
|
||||
public void failed(Throwable exc, ByteBuffer attachment) {
|
||||
context.prepare.incrIllRequestCounter();
|
||||
context.prepare.incrIllegalRequestCounter();
|
||||
channel.offerReadBuffer(attachment);
|
||||
response.finish(true);
|
||||
if (exc != null) {
|
||||
|
||||
Reference in New Issue
Block a user