mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Add additional debugging info to group processing lock handling.
This commit is contained in:
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user