add some more final in Connection
@@ -17,7 +17,7 @@ import java.util.logging.Logger;
class Connection extends Target {
- private static Logger log = Logger.getLogger(Connection.class.getName());
+ private static final Logger log = Logger.getLogger(Connection.class.getName());
private static final int READ_SIZE = 32768;
private static final int READ_REDO = 10;
@@ -30,24 +30,24 @@ class Connection extends Target {
private static final int CLOSED = 3;
private int state = INITIAL;
- private Queue queue = new Queue();
- private Queue myQueue = new Queue();
- private Buffer input = new Buffer(READ_SIZE * 2);
- private Buffer output = new Buffer(WRITE_SIZE * 2);
+ private final Queue queue = new Queue();
+ private final Queue myQueue = new Queue();
+ private final Buffer input = new Buffer(READ_SIZE * 2);
+ private final Buffer output = new Buffer(WRITE_SIZE * 2);
private int maxInputSize = 64*1024;
private int maxOutputSize = 64*1024;
- private Map<Integer, ReplyHandler> replyMap = new HashMap<>();
- private Map<TargetWatcher, TargetWatcher> watchers = new IdentityHashMap<>();
+ private final Map<Integer, ReplyHandler> replyMap = new HashMap<>();
+ private final Map<TargetWatcher, TargetWatcher> watchers = new IdentityHashMap<>();
private int activeReqs = 0;
private int writeWork = 0;
private boolean pendingHandshakeWork = false;
private final TransportThread parent;
- private Supervisor owner;
- private Spec spec;
+ private final Supervisor owner;
+ private final Spec spec;
private CryptoSocket socket;
private int readSize = READ_SIZE;
- private boolean server;
- private AtomicLong requestId = new AtomicLong(0);
+ private final boolean server;
+ private final AtomicLong requestId = new AtomicLong(0);
private SelectionKey selectionKey;
private Exception lostReason = null;
@@ -94,6 +94,7 @@ class Connection extends Target {
this.parent = parent;
this.owner = owner;
this.socket = parent.transport().createCryptoSocket(channel, true);
+ this.spec = null;
server = true;
owner.sessionInit(this);
}
