Add additional debugging info to group processing lock handling.
This commit is contained in:
parent
585c8cd863
commit
8ca89d2024
1 changed files with 10 additions and 3 deletions
|
@ -19,7 +19,7 @@ public final class GroupsV2ProcessingLock {
|
|||
private GroupsV2ProcessingLock() {
|
||||
}
|
||||
|
||||
private static final ReentrantLock lock = new ReentrantLock();
|
||||
private static final GroupReentrantLock lock = new GroupReentrantLock();
|
||||
|
||||
@WorkerThread
|
||||
public static Closeable acquireGroupProcessingLock() throws GroupChangeBusyException {
|
||||
|
@ -37,12 +37,12 @@ public final class GroupsV2ProcessingLock {
|
|||
}
|
||||
|
||||
@WorkerThread
|
||||
public static Closeable acquireGroupProcessingLock(long timeoutMs) throws GroupChangeBusyException {
|
||||
private static Closeable acquireGroupProcessingLock(long timeoutMs) throws GroupChangeBusyException {
|
||||
ThreadUtil.assertNotMainThread();
|
||||
|
||||
try {
|
||||
if (!lock.tryLock(timeoutMs, TimeUnit.MILLISECONDS)) {
|
||||
throw new GroupChangeBusyException("Failed to get a lock on the group processing in the timeout period");
|
||||
throw new GroupChangeBusyException("Failed to get a lock on the group processing in the timeout period. Owner: " + lock.getOwnerName());
|
||||
}
|
||||
return lock::unlock;
|
||||
} catch (InterruptedException e) {
|
||||
|
@ -50,4 +50,11 @@ public final class GroupsV2ProcessingLock {
|
|||
throw new GroupChangeBusyException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static class GroupReentrantLock extends ReentrantLock {
|
||||
String getOwnerName() {
|
||||
Thread owner = super.getOwner();
|
||||
return (owner != null) ? owner.getName() : "null";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue