Skip to content

Commit

Permalink
replace thread interrupted test method
Browse files Browse the repository at this point in the history
which can clean interrupted status
  • Loading branch information
Chris2018998 authored Oct 21, 2022
1 parent a8544e9 commit 50f5554
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/cn/beecp/pool/FastConnectionPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,7 @@ private PooledConnection getPooledConnection() throws SQLException {
boolean failed = false;
Throwable cause = null;
deadline += this.maxWaitNs;
Thread thd = b.thread;


do {
Object s = b.state;//PooledConnection,Throwable,BOWER_NORMAL
if (s instanceof PooledConnection) {
Expand All @@ -452,7 +451,7 @@ private PooledConnection getPooledConnection() throws SQLException {
LockSupport.unpark(this);

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

0 comments on commit 50f5554

Please sign in to comment.