3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-13 10:45:51 +00:00

On Android, use non-cycle detecting locks with fairness activated (experimental)

This commit is contained in:
Mike Hearn 2015-03-13 17:59:24 -07:00
parent 59b426afe0
commit 7f14f7e491

View File

@ -20,6 +20,7 @@ import com.google.common.util.concurrent.CycleDetectingLockFactory;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.Uninterruptibles;
import org.bitcoinj.core.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -152,6 +153,9 @@ public class Threading {
public static CycleDetectingLockFactory factory;
public static ReentrantLock lock(String name) {
if (Utils.isAndroidRuntime())
return new ReentrantLock(true);
else
return factory.newReentrantLock(name);
}