Skip to content

Commit

Permalink
Merge pull request #452 from project-tsurugi/wip/i_811
Browse files Browse the repository at this point in the history
revise rwlock usage in IpcLink
  • Loading branch information
t-horikawa authored Jun 14, 2024
2 parents c49760c + 707d37f commit 7bea73f
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,28 @@ public void remove(ResultSetWireImpl resultSetWire) {

@Override
public boolean isAlive() {
if (closed.get() || (wireHandle == 0)) {
return false;
rwl.readLock().lock();
try {
if (closed.get() || (wireHandle == 0)) {
return false;
}
return isAliveNative(wireHandle);
} finally {
rwl.readLock().unlock();
}
return isAliveNative(wireHandle);
}

@Override
public String linkLostMessage() {
return isShutdownNative(wireHandle) ? "Session already shutdown" : "IPC connection failure";
rwl.readLock().lock();
try {
if (closed.get() || (wireHandle == 0)) {
return "IPC link already closed";
}
return isShutdownNative(wireHandle) ? "Session already shutdown" : "IPC connection failure";
} finally {
rwl.readLock().unlock();
}
}

@Override
Expand Down

0 comments on commit 7bea73f

Please sign in to comment.