本文整理汇总了Java中java.util.concurrent.locks.ReentrantLock.isLocked方法的典型用法代码示例。如果您正苦于以下问题:Java ReentrantLock.isLocked方法的具体用法?Java ReentrantLock.isLocked怎么用?Java ReentrantLock.isLocked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.concurrent.locks.ReentrantLock
的用法示例。
在下文中一共展示了ReentrantLock.isLocked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sayHelloWithReentrantLock
import java.util.concurrent.locks.ReentrantLock; //导入方法依赖的package包/类
@Override
public String sayHelloWithReentrantLock(ReentrantLock receivedLock)
throws RemoteException {
String response = "Hello with lock == " + receivedLock.isLocked();
return response;
}
示例2: run
import java.util.concurrent.locks.ReentrantLock; //导入方法依赖的package包/类
@Override
public void run() {
if (waitIfPaused()) return;
if (delayIfNeed()) return;
ReentrantLock loadFromUriLock = imageLoadingInfo.loadFromUriLock;
log(LOG_START_DISPLAY_IMAGE_TASK);
if (loadFromUriLock.isLocked()) {
log(LOG_WAITING_FOR_IMAGE_LOADED);
}
loadFromUriLock.lock();
Bitmap bmp;
try {
if (checkTaskIsNotActual()) return;
bmp = configuration.memoryCache.get(memoryCacheKey);
if (bmp == null) {
bmp = tryLoadBitmap();
if (imageAwareCollected) return; // listener callback already was fired
if (bmp == null) return; // listener callback already was fired
if (checkTaskIsNotActual() || checkTaskIsInterrupted()) return;
if (options.shouldPreProcess()) {
log(LOG_PREPROCESS_IMAGE);
bmp = options.getPreProcessor().process(bmp);
if (bmp == null) {
L.e(ERROR_PRE_PROCESSOR_NULL);
}
}
if (bmp != null && options.isCacheInMemory()) {
log(LOG_CACHE_IMAGE_IN_MEMORY);
configuration.memoryCache.put(memoryCacheKey, bmp);
}
} else {
loadedFrom = LoadedFrom.MEMORY_CACHE;
log(LOG_GET_IMAGE_FROM_MEMORY_CACHE_AFTER_WAITING);
}
if (bmp != null && options.shouldPostProcess()) {
log(LOG_POSTPROCESS_IMAGE);
bmp = options.getPostProcessor().process(bmp);
if (bmp == null) {
L.e(ERROR_POST_PROCESSOR_NULL, memoryCacheKey);
}
}
} finally {
loadFromUriLock.unlock();
}
if (checkTaskIsNotActual() || checkTaskIsInterrupted()) return;
DisplayBitmapTask displayBitmapTask = new DisplayBitmapTask(bmp, imageLoadingInfo, engine, loadedFrom);
displayBitmapTask.setLoggingEnabled(writeLogs);
if (options.isSyncLoading()) {
displayBitmapTask.run();
} else {
handler.post(displayBitmapTask);
}
}