当前位置: 首页>>代码示例>>Java>>正文


Java ReentrantLock.isLocked方法代码示例

本文整理汇总了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;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:HelloImpl.java

示例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);
	}
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:63,代码来源:LoadAndDisplayImageTask.java


注:本文中的java.util.concurrent.locks.ReentrantLock.isLocked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。