diff --git a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java index 089833861c..09b2f7eadf 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java +++ b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java @@ -412,6 +412,7 @@ public class DefaultChannelPipeline implements ChannelPipeline { return; } catch (Throwable t) { notifyHandlerException(e, t); + return; } } diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioProviderMetadata.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioProviderMetadata.java index 40d666deb4..a44b0e1e36 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioProviderMetadata.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioProviderMetadata.java @@ -184,6 +184,11 @@ class NioProviderMetadata { if (provider.equals("sun.nio.ch.PollSelectorProvider")) { return 1; } + } else if (version.equals("1.6") || version.matches("^1\\.6\\D.*$")) { + if (provider.equals("sun.nio.ch.EPollSelectorProvider") || + provider.equals("sun.nio.ch.PollSelectorProvider")) { + return 2; + } } } // BEA diff --git a/src/main/java/org/jboss/netty/example/discard/ThroughputMonitor.java b/src/main/java/org/jboss/netty/example/discard/ThroughputMonitor.java index 199b30d1dc..469111dd82 100644 --- a/src/main/java/org/jboss/netty/example/discard/ThroughputMonitor.java +++ b/src/main/java/org/jboss/netty/example/discard/ThroughputMonitor.java @@ -53,7 +53,7 @@ public class ThroughputMonitor extends Thread { long newCounter = handler.getTransferredBytes(); System.err.format( "%4.3f MiB/s%n", - (newCounter - oldCounter) * 1000 / (endTime - startTime) / + (newCounter - oldCounter) * 1000.0 / (endTime - startTime) / 1048576.0); oldCounter = newCounter; startTime = endTime; diff --git a/src/main/java/org/jboss/netty/example/echo/ThroughputMonitor.java b/src/main/java/org/jboss/netty/example/echo/ThroughputMonitor.java index a177edfbee..39e41c618b 100644 --- a/src/main/java/org/jboss/netty/example/echo/ThroughputMonitor.java +++ b/src/main/java/org/jboss/netty/example/echo/ThroughputMonitor.java @@ -53,7 +53,7 @@ public class ThroughputMonitor extends Thread { long newCounter = handler.getTransferredBytes(); System.err.format( "%4.3f MiB/s%n", - (newCounter - oldCounter) * 1000 / (endTime - startTime) / + (newCounter - oldCounter) * 1000.0 / (endTime - startTime) / 1048576.0); oldCounter = newCounter; startTime = endTime; diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java index 6a9c663645..743ada1fa0 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java @@ -178,7 +178,7 @@ class ReplayingDecoderBuffer implements ChannelBuffer { } public int indexOf(int fromIndex, int toIndex, byte value) { - int endIndex = indexOf(buffer.readerIndex(), buffer.writerIndex(), value); + int endIndex = buffer.indexOf(buffer.readerIndex(), buffer.writerIndex(), value); if (endIndex < 0) { throw REPLAY; } @@ -187,7 +187,7 @@ class ReplayingDecoderBuffer implements ChannelBuffer { public int indexOf(int fromIndex, int toIndex, ChannelBufferIndexFinder indexFinder) { - int endIndex = indexOf(buffer.readerIndex(), buffer.writerIndex(), indexFinder); + int endIndex = buffer.indexOf(buffer.readerIndex(), buffer.writerIndex(), indexFinder); if (endIndex < 0) { throw REPLAY; } diff --git a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java index 6e2f49a598..e1719f8991 100644 --- a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java @@ -37,6 +37,8 @@ import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelEvent; import org.jboss.netty.channel.ChannelState; import org.jboss.netty.channel.ChannelStateEvent; +import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; import org.jboss.netty.util.LinkedTransferQueue; /** @@ -81,6 +83,9 @@ import org.jboss.netty.util.LinkedTransferQueue; */ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { + private static final InternalLogger logger = + InternalLoggerFactory.getInstance(MemoryAwareThreadPoolExecutor.class); + private volatile Settings settings = new Settings(0, 0); // XXX Can be changed in runtime now. Make it mutable in 3.1. @@ -174,8 +179,11 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { try { Method m = getClass().getMethod("allowCoreThreadTimeOut", new Class[] { boolean.class }); m.invoke(this, Boolean.TRUE); - } catch (Exception e) { + } catch (Throwable t) { // Java 5 + logger.debug( + "ThreadPoolExecutor.allowCoreThreadTimeOut() is not " + + "supported in this platform."); } setMaxChannelMemorySize(maxChannelMemorySize); diff --git a/src/main/java/org/jboss/netty/handler/ssl/SslBufferPool.java b/src/main/java/org/jboss/netty/handler/ssl/SslBufferPool.java index e0dec093a6..4db94ee9c9 100644 --- a/src/main/java/org/jboss/netty/handler/ssl/SslBufferPool.java +++ b/src/main/java/org/jboss/netty/handler/ssl/SslBufferPool.java @@ -77,7 +77,6 @@ public class SslBufferPool { if (maxPoolSize % MAX_PACKET_SIZE != 0) { maxBufferCount ++; } - maxPoolSize = maxBufferCount * MAX_PACKET_SIZE; pool = new ByteBuffer[maxBufferCount]; this.maxBufferCount = maxBufferCount; diff --git a/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java b/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java index 7aabd5d308..7637cb468d 100644 --- a/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java +++ b/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java @@ -616,6 +616,8 @@ public class SslHandler extends FrameDecoder { break; case FINISHED: setHandshakeSuccess(channel); + wrap(ctx, channel); + break loop; case NOT_HANDSHAKING: wrap(ctx, channel); break loop; diff --git a/src/main/java/org/jboss/netty/util/LinkedTransferQueue.java b/src/main/java/org/jboss/netty/util/LinkedTransferQueue.java index 8317a3d8ed..766218fc5e 100644 --- a/src/main/java/org/jboss/netty/util/LinkedTransferQueue.java +++ b/src/main/java/org/jboss/netty/util/LinkedTransferQueue.java @@ -128,7 +128,7 @@ public class LinkedTransferQueue extends AbstractQueue implements Blocking private static final long serialVersionUID = 5925596372370723938L; volatile QNode next; - volatile Thread waiter; // to control park/unpark + transient volatile Thread waiter; // to control park/unpark final boolean isData; QNode(Object item, boolean isData) {