diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java index 455d43a578..2e941fba8d 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java @@ -104,7 +104,7 @@ final class DefaultLocalChannel extends AbstractChannel implements LocalChannel return state.get() == ST_CONNECTED; } - final void setBound() throws ClosedChannelException { + void setBound() throws ClosedChannelException { if (!state.compareAndSet(ST_OPEN, ST_BOUND)) { switch (state.get()) { case ST_CLOSED: @@ -115,7 +115,7 @@ final class DefaultLocalChannel extends AbstractChannel implements LocalChannel } } - final void setConnected() { + void setConnected() { if (state.get() != ST_CLOSED) { state.set(ST_CONNECTED); } diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java index 321f4cc69f..c0922ef314 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java @@ -30,7 +30,7 @@ final class SocketReceiveBufferPool { @SuppressWarnings("unchecked") private final SoftReference[] pool = new SoftReference[POOL_SIZE]; - final ByteBuffer acquire(int size) { + ByteBuffer acquire(int size) { final SoftReference[] pool = this.pool; for (int i = 0; i < POOL_SIZE; i ++) { SoftReference ref = pool[i]; @@ -59,7 +59,7 @@ final class SocketReceiveBufferPool { return buf; } - final void release(ByteBuffer buffer) { + void release(ByteBuffer buffer) { final SoftReference[] pool = this.pool; for (int i = 0; i < POOL_SIZE; i ++) { SoftReference ref = pool[i]; @@ -95,4 +95,4 @@ final class SocketReceiveBufferPool { } return q << 10; } -} \ No newline at end of file +} diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java index ee45e856dd..237d52451c 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java @@ -45,7 +45,7 @@ final class SocketSendBufferPool { super(); } - final SendBuffer acquire(Object message) { + SendBuffer acquire(Object message) { if (message instanceof ChannelBuffer) { return acquire((ChannelBuffer) message); } else if (message instanceof FileRegion) { @@ -320,27 +320,27 @@ final class SocketSendBufferPool { } @Override - public final boolean finished() { + public boolean finished() { return true; } @Override - public final long writtenBytes() { + public long writtenBytes() { return 0; } @Override - public final long totalBytes() { + public long totalBytes() { return 0; } @Override - public final long transferTo(WritableByteChannel ch) throws IOException { + public long transferTo(WritableByteChannel ch) throws IOException { return 0; } @Override - public final long transferTo(DatagramChannel ch, SocketAddress raddr) throws IOException { + public long transferTo(DatagramChannel ch, SocketAddress raddr) throws IOException { return 0; } diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java index 20b65517e5..93117e8d1d 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java @@ -197,7 +197,7 @@ public final class LocalTimeProtocol { return defaultInstance; } - public static final com.google.protobuf.Descriptors.Descriptor + public static com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Location_descriptor; } @@ -226,7 +226,7 @@ public final class LocalTimeProtocol { continent_ = org.jboss.netty.example.localtime.LocalTimeProtocol.Continent.AFRICA; } @Override - public final boolean isInitialized() { + public boolean isInitialized() { if (!hasContinent) { return false; } @@ -560,7 +560,7 @@ public final class LocalTimeProtocol { return defaultInstance; } - public static final com.google.protobuf.Descriptors.Descriptor + public static com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Locations_descriptor; } @@ -586,7 +586,7 @@ public final class LocalTimeProtocol { private void initFields() { } @Override - public final boolean isInitialized() { + public boolean isInitialized() { for (org.jboss.netty.example.localtime.LocalTimeProtocol.Location element : getLocationList()) { if (!element.isInitialized()) { return false; @@ -917,7 +917,7 @@ public final class LocalTimeProtocol { return defaultInstance; } - public static final com.google.protobuf.Descriptors.Descriptor + public static com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTime_descriptor; } @@ -981,7 +981,7 @@ public final class LocalTimeProtocol { dayOfWeek_ = org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek.SUNDAY; } @Override - public final boolean isInitialized() { + public boolean isInitialized() { if (!hasYear) { return false; } @@ -1487,7 +1487,7 @@ public final class LocalTimeProtocol { return defaultInstance; } - public static final com.google.protobuf.Descriptors.Descriptor + public static com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTimes_descriptor; } @@ -1513,7 +1513,7 @@ public final class LocalTimeProtocol { private void initFields() { } @Override - public final boolean isInitialized() { + public boolean isInitialized() { for (org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime element : getLocalTimeList()) { if (!element.isInitialized()) { return false; diff --git a/src/main/java/org/jboss/netty/util/internal/ConcurrentHashMap.java b/src/main/java/org/jboss/netty/util/internal/ConcurrentHashMap.java index e22e75614d..c8cc4854f6 100644 --- a/src/main/java/org/jboss/netty/util/internal/ConcurrentHashMap.java +++ b/src/main/java/org/jboss/netty/util/internal/ConcurrentHashMap.java @@ -138,7 +138,7 @@ public final class ConcurrentHashMap extends AbstractMap * @param hash the hash code for the key * @return the segment */ - final Segment segmentFor(int hash) { + Segment segmentFor(int hash) { return segments[hash >>> segmentShift & segmentMask]; } @@ -173,21 +173,21 @@ public final class ConcurrentHashMap extends AbstractMap } @SuppressWarnings("unchecked") - final K key() { + K key() { return (K) key; } @SuppressWarnings("unchecked") - final V value() { + V value() { return (V) value; } - final void setValue(V value) { + void setValue(V value) { this.value = value; } @SuppressWarnings("unchecked") - static final HashEntry[] newArray(int i) { + static HashEntry[] newArray(int i) { return new HashEntry[i]; } } @@ -273,7 +273,7 @@ public final class ConcurrentHashMap extends AbstractMap } @SuppressWarnings("unchecked") - static final Segment[] newArray(int i) { + static Segment[] newArray(int i) { return new Segment[i]; } diff --git a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java index 9e06a05fee..7f82088dca 100644 --- a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java +++ b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java @@ -138,7 +138,7 @@ public final class ConcurrentIdentityHashMap extends AbstractMap * @param hash the hash code for the key * @return the segment */ - final Segment segmentFor(int hash) { + Segment segmentFor(int hash) { return segments[hash >>> segmentShift & segmentMask]; } @@ -173,21 +173,21 @@ public final class ConcurrentIdentityHashMap extends AbstractMap } @SuppressWarnings("unchecked") - final K key() { + K key() { return (K) key; } @SuppressWarnings("unchecked") - final V value() { + V value() { return (V) value; } - final void setValue(V value) { + void setValue(V value) { this.value = value; } @SuppressWarnings("unchecked") - static final HashEntry[] newArray(int i) { + static HashEntry[] newArray(int i) { return new HashEntry[i]; } } @@ -273,7 +273,7 @@ public final class ConcurrentIdentityHashMap extends AbstractMap } @SuppressWarnings("unchecked") - static final Segment[] newArray(int i) { + static Segment[] newArray(int i) { return new Segment[i]; } diff --git a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityWeakKeyHashMap.java b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityWeakKeyHashMap.java index 1c7f546cbb..4df097d353 100644 --- a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityWeakKeyHashMap.java +++ b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityWeakKeyHashMap.java @@ -145,7 +145,7 @@ public final class ConcurrentIdentityWeakKeyHashMap extends AbstractMap segmentFor(int hash) { + Segment segmentFor(int hash) { return segments[hash >>> segmentShift & segmentMask]; } @@ -167,11 +167,11 @@ public final class ConcurrentIdentityWeakKeyHashMap extends AbstractMap extends AbstractMap) keyRef).get(); } - final V value() { + V value() { return dereferenceValue(valueRef); } @SuppressWarnings("unchecked") - final V dereferenceValue(Object value) { + V dereferenceValue(Object value) { if (value instanceof WeakKeyReference) { return ((Reference) value).get(); } @@ -221,12 +221,12 @@ public final class ConcurrentIdentityWeakKeyHashMap extends AbstractMap HashEntry[] newArray(int i) { + static HashEntry[] newArray(int i) { return new HashEntry[i]; } } @@ -318,7 +318,7 @@ public final class ConcurrentIdentityWeakKeyHashMap extends AbstractMap Segment[] newArray(int i) { + static Segment[] newArray(int i) { return new Segment[i]; } @@ -618,7 +618,7 @@ public final class ConcurrentIdentityWeakKeyHashMap extends AbstractMap extends AbstractMap impl * @param hash the hash code for the key * @return the segment */ - final Segment segmentFor(int hash) { + Segment segmentFor(int hash) { return segments[hash >>> segmentShift & segmentMask]; } @@ -167,11 +167,11 @@ public final class ConcurrentWeakKeyHashMap extends AbstractMap impl this.hash = hash; } - public final int keyHash() { + public int keyHash() { return hash; } - public final Object keyRef() { + public Object keyRef() { return this; } } @@ -204,16 +204,16 @@ public final class ConcurrentWeakKeyHashMap extends AbstractMap impl } @SuppressWarnings("unchecked") - final K key() { + K key() { return ((WeakReference) keyRef).get(); } - final V value() { + V value() { return dereferenceValue(valueRef); } @SuppressWarnings("unchecked") - final V dereferenceValue(Object value) { + V dereferenceValue(Object value) { if (value instanceof WeakKeyReference) { return ((Reference) value).get(); } @@ -221,12 +221,12 @@ public final class ConcurrentWeakKeyHashMap extends AbstractMap impl return (V) value; } - final void setValue(V value) { + void setValue(V value) { this.valueRef = value; } @SuppressWarnings("unchecked") - static final HashEntry[] newArray(int i) { + static HashEntry[] newArray(int i) { return new HashEntry[i]; } } @@ -318,7 +318,7 @@ public final class ConcurrentWeakKeyHashMap extends AbstractMap impl } @SuppressWarnings("unchecked") - static final Segment[] newArray(int i) { + static Segment[] newArray(int i) { return new Segment[i]; } @@ -618,7 +618,7 @@ public final class ConcurrentWeakKeyHashMap extends AbstractMap impl } @SuppressWarnings("rawtypes") - final void removeStale() { + void removeStale() { WeakKeyReference ref; while ((ref = (WeakKeyReference) refQueue.poll()) != null) { remove(ref.keyRef(), ref.keyHash(), null, true); diff --git a/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java b/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java index 7ca6974c1a..41d645e420 100644 --- a/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java +++ b/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java @@ -437,7 +437,7 @@ public class LinkedTransferQueue extends AbstractQueue volatile Thread waiter; // null until waiting // CAS methods for fields - final boolean casNext(Node cmp, Node val) { + boolean casNext(Node cmp, Node val) { if (AtomicFieldUpdaterUtil.isAvailable()) { return nextUpdater.compareAndSet(this, cmp, val); } else { @@ -452,7 +452,7 @@ public class LinkedTransferQueue extends AbstractQueue } } - final boolean casItem(Object cmp, Object val) { + boolean casItem(Object cmp, Object val) { // assert cmp == null || cmp.getClass() != Node.class; if (AtomicFieldUpdaterUtil.isAvailable()) { return itemUpdater.compareAndSet(this, cmp, val); @@ -481,7 +481,7 @@ public class LinkedTransferQueue extends AbstractQueue * Links node to itself to avoid garbage retention. Called * only after CASing head field, so uses relaxed write. */ - final void forgetNext() { + void forgetNext() { this.next = this; } @@ -494,7 +494,7 @@ public class LinkedTransferQueue extends AbstractQueue * follows either CAS or return from park (if ever parked; * else we don't care). */ - final void forgetContents() { + void forgetContents() { this.item = this; this.waiter = null; } @@ -503,7 +503,7 @@ public class LinkedTransferQueue extends AbstractQueue * Returns true if this node has been matched, including the * case of artificial matches due to cancellation. */ - final boolean isMatched() { + boolean isMatched() { Object x = item; return x == this || x == null == isData; } @@ -511,7 +511,7 @@ public class LinkedTransferQueue extends AbstractQueue /** * Returns true if this is an unmatched request node. */ - final boolean isUnmatchedRequest() { + boolean isUnmatchedRequest() { return !isData && item == null; } @@ -520,7 +520,7 @@ public class LinkedTransferQueue extends AbstractQueue * appended to this node because this node is unmatched and * has opposite data mode. */ - final boolean cannotPrecede(boolean haveData) { + boolean cannotPrecede(boolean haveData) { boolean d = isData; Object x; return d != haveData && (x = item) != this && x != null == d; @@ -529,7 +529,7 @@ public class LinkedTransferQueue extends AbstractQueue /** * Tries to artificially match a data node -- used by remove. */ - final boolean tryMatchData() { + boolean tryMatchData() { // assert isData; Object x = item; if (x != null && x != this && casItem(x, null)) { @@ -895,12 +895,12 @@ public class LinkedTransferQueue extends AbstractQueue } @Override - public final boolean hasNext() { + public boolean hasNext() { return nextNode != null; } @Override - public final E next() { + public E next() { Node p = nextNode; if (p == null) { throw new NoSuchElementException(); @@ -911,7 +911,7 @@ public class LinkedTransferQueue extends AbstractQueue } @Override - public final void remove() { + public void remove() { Node p = lastRet; if (p == null) { throw new IllegalStateException(); diff --git a/src/main/java/org/jboss/netty/util/internal/NonReentrantLock.java b/src/main/java/org/jboss/netty/util/internal/NonReentrantLock.java index b6aeb02625..bc05add136 100644 --- a/src/main/java/org/jboss/netty/util/internal/NonReentrantLock.java +++ b/src/main/java/org/jboss/netty/util/internal/NonReentrantLock.java @@ -68,7 +68,7 @@ public final class NonReentrantLock extends AbstractQueuedSynchronizer } @Override - protected final boolean tryAcquire(int acquires) { + protected boolean tryAcquire(int acquires) { if (compareAndSetState(0, 1)) { owner = Thread.currentThread(); return true; @@ -77,7 +77,7 @@ public final class NonReentrantLock extends AbstractQueuedSynchronizer } @Override - protected final boolean tryRelease(int releases) { + protected boolean tryRelease(int releases) { if (Thread.currentThread() != owner) { throw new IllegalMonitorStateException(); } @@ -87,7 +87,7 @@ public final class NonReentrantLock extends AbstractQueuedSynchronizer } @Override - protected final boolean isHeldExclusively() { + protected boolean isHeldExclusively() { return getState() != 0 && owner == Thread.currentThread(); } }