Skip to content

Commit 88e3d68

Browse files
committed
Refactor remove unnecessary variables for lock
1 parent 1837f88 commit 88e3d68

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

src/main/java/io/ebean/datasource/pool/PooledConnectionQueue.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ private PoolStatus createStatus() {
103103
}
104104

105105
public String toString() {
106-
final ReentrantLock lock = this.lock;
107106
lock.lock();
108107
try {
109108
return createStatus().toString();
@@ -113,7 +112,6 @@ public String toString() {
113112
}
114113

115114
public PoolStatus getStatus(boolean reset) {
116-
final ReentrantLock lock = this.lock;
117115
lock.lock();
118116
try {
119117
PoolStatus s = createStatus();
@@ -129,7 +127,6 @@ public PoolStatus getStatus(boolean reset) {
129127
}
130128

131129
void setMinSize(int minSize) {
132-
final ReentrantLock lock = this.lock;
133130
lock.lock();
134131
try {
135132
if (minSize > this.maxSize) {
@@ -142,7 +139,6 @@ void setMinSize(int minSize) {
142139
}
143140

144141
void setMaxSize(int maxSize) {
145-
final ReentrantLock lock = this.lock;
146142
lock.lock();
147143
try {
148144
if (maxSize < this.minSize) {
@@ -156,7 +152,6 @@ void setMaxSize(int maxSize) {
156152
}
157153

158154
void setWarningSize(int warningSize) {
159-
final ReentrantLock lock = this.lock;
160155
lock.lock();
161156
try {
162157
if (warningSize > this.maxSize) {
@@ -173,7 +168,6 @@ private int totalConnections() {
173168
}
174169

175170
void ensureMinimumConnections() throws SQLException {
176-
final ReentrantLock lock = this.lock;
177171
lock.lock();
178172
try {
179173
int add = minSize - totalConnections();
@@ -193,7 +187,6 @@ void ensureMinimumConnections() throws SQLException {
193187
* Return a PooledConnection.
194188
*/
195189
void returnPooledConnection(PooledConnection c, boolean forceClose) {
196-
final ReentrantLock lock = this.lock;
197190
lock.lock();
198191
try {
199192
if (!busyList.remove(c)) {
@@ -242,7 +235,6 @@ private int registerBusyConnection(PooledConnection c) {
242235
}
243236

244237
private PooledConnection _getPooledConnection() throws InterruptedException, SQLException {
245-
final ReentrantLock lock = this.lock;
246238
lock.lockInterruptibly();
247239
try {
248240
if (doingShutdown) {
@@ -320,7 +312,6 @@ private PooledConnection _getPooledConnectionWaitLoop() throws SQLException, Int
320312
}
321313

322314
public void shutdown() {
323-
final ReentrantLock lock = this.lock;
324315
lock.lock();
325316
try {
326317
doingShutdown = true;
@@ -347,7 +338,6 @@ public void shutdown() {
347338
* This is typically done when a database down event occurs.
348339
*/
349340
public void reset(long leakTimeMinutes) {
350-
final ReentrantLock lock = this.lock;
351341
lock.lock();
352342
try {
353343
PoolStatus status = createStatus();
@@ -368,7 +358,6 @@ public void reset(long leakTimeMinutes) {
368358
}
369359

370360
public void trim(long maxInactiveMillis, long maxAgeMillis) {
371-
final ReentrantLock lock = this.lock;
372361
lock.lock();
373362
try {
374363
if (trimInactiveConnections(maxInactiveMillis, maxAgeMillis) > 0) {
@@ -401,7 +390,6 @@ private int trimInactiveConnections(long maxInactiveMillis, long maxAgeMillis) {
401390
* Close all the connections that are in the free list.
402391
*/
403392
private void closeFreeConnections(boolean logErrors) {
404-
final ReentrantLock lock = this.lock;
405393
lock.lock();
406394
try {
407395
freeList.closeAll(logErrors);
@@ -421,7 +409,6 @@ private void closeFreeConnections(boolean logErrors) {
421409
* closed and put back into the pool.
422410
*/
423411
void closeBusyConnections(long leakTimeMinutes) {
424-
final ReentrantLock lock = this.lock;
425412
lock.lock();
426413
try {
427414
busyList.closeBusyConnections(leakTimeMinutes);
@@ -461,7 +448,6 @@ void dumpBusyConnectionInformation() {
461448
* Returns information describing connections that are currently being used.
462449
*/
463450
private String getBusyConnectionInformation(boolean toLogger) {
464-
final ReentrantLock lock = this.lock;
465451
lock.lock();
466452
try {
467453
return busyList.getBusyConnectionInformation(toLogger);

0 commit comments

Comments
 (0)