Fixed warnings reported by FindBugs

This commit is contained in:
Trustin Lee 2008-11-07 02:26:21 +00:00
parent 9d35088801
commit 81d29bafc2
9 changed files with 22 additions and 7 deletions

View File

@ -412,6 +412,7 @@ public class DefaultChannelPipeline implements ChannelPipeline {
return; return;
} catch (Throwable t) { } catch (Throwable t) {
notifyHandlerException(e, t); notifyHandlerException(e, t);
return;
} }
} }

View File

@ -184,6 +184,11 @@ class NioProviderMetadata {
if (provider.equals("sun.nio.ch.PollSelectorProvider")) { if (provider.equals("sun.nio.ch.PollSelectorProvider")) {
return 1; 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 // BEA

View File

@ -53,7 +53,7 @@ public class ThroughputMonitor extends Thread {
long newCounter = handler.getTransferredBytes(); long newCounter = handler.getTransferredBytes();
System.err.format( System.err.format(
"%4.3f MiB/s%n", "%4.3f MiB/s%n",
(newCounter - oldCounter) * 1000 / (endTime - startTime) / (newCounter - oldCounter) * 1000.0 / (endTime - startTime) /
1048576.0); 1048576.0);
oldCounter = newCounter; oldCounter = newCounter;
startTime = endTime; startTime = endTime;

View File

@ -53,7 +53,7 @@ public class ThroughputMonitor extends Thread {
long newCounter = handler.getTransferredBytes(); long newCounter = handler.getTransferredBytes();
System.err.format( System.err.format(
"%4.3f MiB/s%n", "%4.3f MiB/s%n",
(newCounter - oldCounter) * 1000 / (endTime - startTime) / (newCounter - oldCounter) * 1000.0 / (endTime - startTime) /
1048576.0); 1048576.0);
oldCounter = newCounter; oldCounter = newCounter;
startTime = endTime; startTime = endTime;

View File

@ -178,7 +178,7 @@ class ReplayingDecoderBuffer implements ChannelBuffer {
} }
public int indexOf(int fromIndex, int toIndex, byte value) { 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) { if (endIndex < 0) {
throw REPLAY; throw REPLAY;
} }
@ -187,7 +187,7 @@ class ReplayingDecoderBuffer implements ChannelBuffer {
public int indexOf(int fromIndex, int toIndex, public int indexOf(int fromIndex, int toIndex,
ChannelBufferIndexFinder indexFinder) { ChannelBufferIndexFinder indexFinder) {
int endIndex = indexOf(buffer.readerIndex(), buffer.writerIndex(), indexFinder); int endIndex = buffer.indexOf(buffer.readerIndex(), buffer.writerIndex(), indexFinder);
if (endIndex < 0) { if (endIndex < 0) {
throw REPLAY; throw REPLAY;
} }

View File

@ -37,6 +37,8 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelEvent; import org.jboss.netty.channel.ChannelEvent;
import org.jboss.netty.channel.ChannelState; import org.jboss.netty.channel.ChannelState;
import org.jboss.netty.channel.ChannelStateEvent; import org.jboss.netty.channel.ChannelStateEvent;
import org.jboss.netty.logging.InternalLogger;
import org.jboss.netty.logging.InternalLoggerFactory;
import org.jboss.netty.util.LinkedTransferQueue; import org.jboss.netty.util.LinkedTransferQueue;
/** /**
@ -81,6 +83,9 @@ import org.jboss.netty.util.LinkedTransferQueue;
*/ */
public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor {
private static final InternalLogger logger =
InternalLoggerFactory.getInstance(MemoryAwareThreadPoolExecutor.class);
private volatile Settings settings = new Settings(0, 0); private volatile Settings settings = new Settings(0, 0);
// XXX Can be changed in runtime now. Make it mutable in 3.1. // XXX Can be changed in runtime now. Make it mutable in 3.1.
@ -174,8 +179,11 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor {
try { try {
Method m = getClass().getMethod("allowCoreThreadTimeOut", new Class[] { boolean.class }); Method m = getClass().getMethod("allowCoreThreadTimeOut", new Class[] { boolean.class });
m.invoke(this, Boolean.TRUE); m.invoke(this, Boolean.TRUE);
} catch (Exception e) { } catch (Throwable t) {
// Java 5 // Java 5
logger.debug(
"ThreadPoolExecutor.allowCoreThreadTimeOut() is not " +
"supported in this platform.");
} }
setMaxChannelMemorySize(maxChannelMemorySize); setMaxChannelMemorySize(maxChannelMemorySize);

View File

@ -77,7 +77,6 @@ public class SslBufferPool {
if (maxPoolSize % MAX_PACKET_SIZE != 0) { if (maxPoolSize % MAX_PACKET_SIZE != 0) {
maxBufferCount ++; maxBufferCount ++;
} }
maxPoolSize = maxBufferCount * MAX_PACKET_SIZE;
pool = new ByteBuffer[maxBufferCount]; pool = new ByteBuffer[maxBufferCount];
this.maxBufferCount = maxBufferCount; this.maxBufferCount = maxBufferCount;

View File

@ -616,6 +616,8 @@ public class SslHandler extends FrameDecoder {
break; break;
case FINISHED: case FINISHED:
setHandshakeSuccess(channel); setHandshakeSuccess(channel);
wrap(ctx, channel);
break loop;
case NOT_HANDSHAKING: case NOT_HANDSHAKING:
wrap(ctx, channel); wrap(ctx, channel);
break loop; break loop;

View File

@ -128,7 +128,7 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E> implements Blocking
private static final long serialVersionUID = 5925596372370723938L; private static final long serialVersionUID = 5925596372370723938L;
volatile QNode next; volatile QNode next;
volatile Thread waiter; // to control park/unpark transient volatile Thread waiter; // to control park/unpark
final boolean isData; final boolean isData;
QNode(Object item, boolean isData) { QNode(Object item, boolean isData) {