diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaders.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaders.java index b5a508ef7e..abff206a3e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaders.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaders.java @@ -406,6 +406,8 @@ public class HttpHeaders { } } + private static final int BUCKET_SIZE = 17; + private static int hash(String name) { int h = 0; for (int i = name.length() - 1; i >= 0; i --) { @@ -449,17 +451,17 @@ public class HttpHeaders { return true; } - private final Entry[] entries = new Entry[17]; + private static int index(int hash) { + return hash % BUCKET_SIZE; + } + + private final Entry[] entries = new Entry[BUCKET_SIZE]; private final Entry head = new Entry(-1, null, null); HttpHeaders() { head.before = head.after = head; } - private int index(int hash) { - return hash % entries.length; - } - void validateHeaderName(String name) { HttpCodecUtil.validateHeaderName(name); }