Cleanup : for loops for arrays to make code easier to read and removed unnecessary toLowerCase()
This commit is contained in:
parent
e090178de3
commit
d576fca0dd
@ -442,8 +442,7 @@ abstract class PoolArena<T> implements PoolArenaMetric {
|
||||
|
||||
private static List<PoolSubpageMetric> subPageMetricList(PoolSubpage<?>[] pages) {
|
||||
List<PoolSubpageMetric> metrics = new ArrayList<PoolSubpageMetric>();
|
||||
for (int i = 0; i < pages.length; i ++) {
|
||||
PoolSubpage<?> head = pages[i];
|
||||
for (PoolSubpage<?> head : pages) {
|
||||
if (head.next == head) {
|
||||
continue;
|
||||
}
|
||||
|
@ -457,8 +457,8 @@ public class PooledByteBufAllocator extends AbstractByteBufAllocator {
|
||||
}
|
||||
|
||||
int total = 0;
|
||||
for (int i = 0; i < arenas.length; i++) {
|
||||
total += arenas[i].numThreadCaches.get();
|
||||
for (PoolArena<?> arena : arenas) {
|
||||
total += arena.numThreadCaches.get();
|
||||
}
|
||||
|
||||
return total;
|
||||
|
@ -893,11 +893,11 @@ public class SslHandler extends ByteToMessageDecoder implements ChannelOutboundH
|
||||
*/
|
||||
private boolean ignoreException(Throwable t) {
|
||||
if (!(t instanceof SSLException) && t instanceof IOException && sslClosePromise.isDone()) {
|
||||
String message = String.valueOf(t.getMessage()).toLowerCase();
|
||||
String message = t.getMessage();
|
||||
|
||||
// first try to match connection reset / broke peer based on the regex. This is the fastest way
|
||||
// but may fail on different jdk impls or OS's
|
||||
if (IGNORABLE_ERROR_MESSAGE.matcher(message).matches()) {
|
||||
if (message != null && IGNORABLE_ERROR_MESSAGE.matcher(message).matches()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -134,8 +134,7 @@ final class IovArray implements MessageProcessor {
|
||||
// No more room!
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < buffers.length; i++) {
|
||||
ByteBuffer nioBuffer = buffers[i];
|
||||
for (ByteBuffer nioBuffer : buffers) {
|
||||
int offset = nioBuffer.position();
|
||||
int len = nioBuffer.limit() - nioBuffer.position();
|
||||
if (len == 0) {
|
||||
|
@ -39,10 +39,10 @@ final class NativeDatagramPacketArray implements ChannelOutboundBuffer.MessagePr
|
||||
|
||||
@Override
|
||||
protected void onRemoval(NativeDatagramPacketArray value) throws Exception {
|
||||
NativeDatagramPacket[] array = value.packets;
|
||||
NativeDatagramPacket[] packetsArray = value.packets;
|
||||
// Release all packets
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i].release();
|
||||
for (NativeDatagramPacket datagramPacket : packetsArray) {
|
||||
datagramPacket.release();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user