From 8b776590fa358bf168002db91ebcb03ed646f579 Mon Sep 17 00:00:00 2001 From: fhanik Date: Sat, 14 Apr 2007 02:48:45 +0000 Subject: [PATCH] Minor optimizations git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@528744 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/tomcat/util/net/NioEndpoint.java | 7 +++++-- java/org/apache/tomcat/util/net/SocketProperties.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 2e76cad05..b26da8f82 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -1326,7 +1326,7 @@ public class NioEndpoint { public void addEvent(Runnable event) { events.offer(event); - if ( wakeupCounter.incrementAndGet() < 3 ) selector.wakeup(); + if ( wakeupCounter.incrementAndGet() == 1 || wakeupCounter.get() > 5 ) selector.wakeup(); } /** @@ -1428,7 +1428,10 @@ public class NioEndpoint { int keyCount = 0; try { if ( !close ) { - keyCount = selector.select(selectorTimeout); + if ( wakeupCounter.get() > 0 ) + keyCount = selector.selectNow(); //we have events that need to be processed + else + keyCount = selector.select(selectorTimeout); wakeupCounter.set(0); } if (close) { diff --git a/java/org/apache/tomcat/util/net/SocketProperties.java b/java/org/apache/tomcat/util/net/SocketProperties.java index 6551834d0..4392a234b 100644 --- a/java/org/apache/tomcat/util/net/SocketProperties.java +++ b/java/org/apache/tomcat/util/net/SocketProperties.java @@ -82,7 +82,7 @@ public class SocketProperties { * The application write buffer size in bytes * Default value is txBufSize */ - protected int appWriteBufSize = 8192; + protected int appWriteBufSize = txBufSize; /** * NioChannel pool size for the endpoint, -- 2.11.0