1)replaced all netty link transfer queue by java 7 link transfer queue to avoid high cpu usage 2)optimized selector loop

This commit is contained in:
Jestan Nirojan 2011-12-06 19:40:22 +05:30
parent 460237d3f3
commit 3379a4c25d
7 changed files with 19 additions and 6 deletions

13
pom.xml
View File

@ -661,5 +661,18 @@
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>archiva.internal</id>
<name>Internal Release Repository</name>
<url>http://192.168.0.7:8080/archiva/repository/internal/</url>
</repository>
<snapshotRepository>
<id>archiva.snapshots</id>
<name>Internal Snapshot Repository</name>
<url>http://192.168.0.7:8080/archiva/repository/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>

View File

@ -19,12 +19,12 @@ import com.sun.nio.sctp.Association;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.*;
import org.jboss.netty.channel.socket.sctp.SctpSendBufferPool.SendBuffer;
import org.jboss.netty.util.internal.LinkedTransferQueue;
import org.jboss.netty.util.internal.ThreadLocalBoolean;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.*;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

View File

@ -19,7 +19,6 @@ import org.jboss.netty.channel.*;
import org.jboss.netty.logging.InternalLogger;
import org.jboss.netty.logging.InternalLoggerFactory;
import org.jboss.netty.util.internal.DeadLockProofWorker;
import org.jboss.netty.util.internal.LinkedTransferQueue;
import java.io.IOException;
import java.net.ConnectException;
@ -32,6 +31,7 @@ import java.util.Queue;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

View File

@ -223,7 +223,7 @@ class SctpServerPipelineSink extends AbstractChannelSink {
try {
for (;;) {
try {
if (selector.select(1000) > 0) {
if (selector.select(500) > 0) {
selector.selectedKeys().clear();
}

View File

@ -24,7 +24,6 @@ import org.jboss.netty.channel.socket.sctp.SctpSendBufferPool.SendBuffer;
import org.jboss.netty.logging.InternalLogger;
import org.jboss.netty.logging.InternalLoggerFactory;
import org.jboss.netty.util.internal.DeadLockProofWorker;
import org.jboss.netty.util.internal.LinkedTransferQueue;
import java.io.IOException;
import java.net.SocketAddress;
@ -35,6 +34,7 @@ import java.util.Queue;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

View File

@ -37,7 +37,7 @@ final class SelectorUtil {
static void select(Selector selector) throws IOException {
try {
selector.select(500);
selector.select(10);
} catch (CancelledKeyException e) {
// Harmless exception - log anyway
logger.debug(

View File

@ -19,6 +19,7 @@ import java.lang.reflect.Method;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadFactory;
@ -39,7 +40,6 @@ import org.jboss.netty.logging.InternalLoggerFactory;
import org.jboss.netty.util.DefaultObjectSizeEstimator;
import org.jboss.netty.util.ObjectSizeEstimator;
import org.jboss.netty.util.internal.ConcurrentIdentityHashMap;
import org.jboss.netty.util.internal.LinkedTransferQueue;
import org.jboss.netty.util.internal.SharedResourceMisuseDetector;
/**