Adding 'final' keyword for private fields where possible
Motivation Missing 'final' keyword for fields Modifications Add 'final' for fields where possible Result More safe and consistent code
This commit is contained in:
parent
974a251de8
commit
0cf3f54a8d
@ -50,7 +50,7 @@ public class ByteBufInputStream extends InputStream implements DataInput {
|
|||||||
* However in future releases ownership should always be transferred and callers of this class should call
|
* However in future releases ownership should always be transferred and callers of this class should call
|
||||||
* {@link ReferenceCounted#retain()} if necessary.
|
* {@link ReferenceCounted#retain()} if necessary.
|
||||||
*/
|
*/
|
||||||
private boolean releaseOnClose;
|
private final boolean releaseOnClose;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new stream which reads data from the specified {@code buffer}
|
* Creates a new stream which reads data from the specified {@code buffer}
|
||||||
|
@ -27,7 +27,7 @@ import io.netty.util.internal.UnstableApi;
|
|||||||
public final class DefaultHttp2GoAwayFrame extends DefaultByteBufHolder implements Http2GoAwayFrame {
|
public final class DefaultHttp2GoAwayFrame extends DefaultByteBufHolder implements Http2GoAwayFrame {
|
||||||
|
|
||||||
private final long errorCode;
|
private final long errorCode;
|
||||||
private int lastStreamId;
|
private final int lastStreamId;
|
||||||
private int extraStreamIds;
|
private int extraStreamIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,13 +71,13 @@ public final class FixedRedisMessagePool implements RedisMessagePool {
|
|||||||
public static final FixedRedisMessagePool INSTANCE = new FixedRedisMessagePool();
|
public static final FixedRedisMessagePool INSTANCE = new FixedRedisMessagePool();
|
||||||
|
|
||||||
// internal caches.
|
// internal caches.
|
||||||
private Map<ByteBuf, SimpleStringRedisMessage> byteBufToSimpleStrings;
|
private final Map<ByteBuf, SimpleStringRedisMessage> byteBufToSimpleStrings;
|
||||||
private Map<String, SimpleStringRedisMessage> stringToSimpleStrings;
|
private final Map<String, SimpleStringRedisMessage> stringToSimpleStrings;
|
||||||
private Map<ByteBuf, ErrorRedisMessage> byteBufToErrors;
|
private final Map<ByteBuf, ErrorRedisMessage> byteBufToErrors;
|
||||||
private Map<String, ErrorRedisMessage> stringToErrors;
|
private final Map<String, ErrorRedisMessage> stringToErrors;
|
||||||
private Map<ByteBuf, IntegerRedisMessage> byteBufToIntegers;
|
private final Map<ByteBuf, IntegerRedisMessage> byteBufToIntegers;
|
||||||
private LongObjectMap<IntegerRedisMessage> longToIntegers;
|
private final LongObjectMap<IntegerRedisMessage> longToIntegers;
|
||||||
private LongObjectMap<byte[]> longToByteBufs;
|
private final LongObjectMap<byte[]> longToByteBufs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link FixedRedisMessagePool} instance.
|
* Creates a {@link FixedRedisMessagePool} instance.
|
||||||
|
@ -31,7 +31,7 @@ public abstract class ConstantPool<T extends Constant<T>> {
|
|||||||
|
|
||||||
private final ConcurrentMap<String, T> constants = PlatformDependent.newConcurrentHashMap();
|
private final ConcurrentMap<String, T> constants = PlatformDependent.newConcurrentHashMap();
|
||||||
|
|
||||||
private AtomicInteger nextId = new AtomicInteger(1);
|
private final AtomicInteger nextId = new AtomicInteger(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shortcut of {@link #valueOf(String) valueOf(firstNameComponent.getName() + "#" + secondNameComponent)}.
|
* Shortcut of {@link #valueOf(String) valueOf(firstNameComponent.getName() + "#" + secondNameComponent)}.
|
||||||
|
@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* Reads the first {@link Http2Settings} object and notifies a {@link io.netty.channel.ChannelPromise}
|
* Reads the first {@link Http2Settings} object and notifies a {@link io.netty.channel.ChannelPromise}
|
||||||
*/
|
*/
|
||||||
public class Http2SettingsHandler extends SimpleChannelInboundHandler<Http2Settings> {
|
public class Http2SettingsHandler extends SimpleChannelInboundHandler<Http2Settings> {
|
||||||
private ChannelPromise promise;
|
private final ChannelPromise promise;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new instance
|
* Create new instance
|
||||||
|
@ -35,7 +35,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
*/
|
*/
|
||||||
public class HttpResponseHandler extends SimpleChannelInboundHandler<FullHttpResponse> {
|
public class HttpResponseHandler extends SimpleChannelInboundHandler<FullHttpResponse> {
|
||||||
|
|
||||||
private Map<Integer, Entry<ChannelFuture, ChannelPromise>> streamidPromiseMap;
|
private final Map<Integer, Entry<ChannelFuture, ChannelPromise>> streamidPromiseMap;
|
||||||
|
|
||||||
public HttpResponseHandler() {
|
public HttpResponseHandler() {
|
||||||
// Use a concurrent map because we add and iterate from the main thread (just for the purposes of the example),
|
// Use a concurrent map because we add and iterate from the main thread (just for the purposes of the example),
|
||||||
|
@ -154,7 +154,7 @@ public final class DefaultChannelId implements ChannelId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final byte[] data;
|
private final byte[] data;
|
||||||
private int hashCode;
|
private final int hashCode;
|
||||||
|
|
||||||
private transient String shortValue;
|
private transient String shortValue;
|
||||||
private transient String longValue;
|
private transient String longValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user