Skip to content

Commit 50f5554

Browse files
authored
replace thread interrupted test method
which can clean interrupted status
1 parent a8544e9 commit 50f5554

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/main/java/cn/beecp/pool/FastConnectionPool.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,7 @@ private PooledConnection getPooledConnection() throws SQLException {
424424
boolean failed = false;
425425
Throwable cause = null;
426426
deadline += this.maxWaitNs;
427-
Thread thd = b.thread;
428-
427+
429428
do {
430429
Object s = b.state;//PooledConnection,Throwable,BOWER_NORMAL
431430
if (s instanceof PooledConnection) {
@@ -452,7 +451,7 @@ private PooledConnection getPooledConnection() throws SQLException {
452451
LockSupport.unpark(this);
453452

454453
LockSupport.parkNanos(t);//block exit:1:get transfer 2:timeout 3:interrupted
455-
if (thd.isInterrupted()) {
454+
if (Thread.interrupted()) {//auto clear interrupted status
456455
failed = true;
457456
cause = new SQLException("Interrupted during getting connection");
458457
BorrowStUpd.compareAndSet(b, BOWER_WAITING, cause);

0 commit comments

Comments
 (0)