本文整理了Java中com.bumptech.glide.util.Util.assertBackgroundThread()
方法的一些代码示例,展示了Util.assertBackgroundThread()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.assertBackgroundThread()
方法的具体详情如下:
包路径:com.bumptech.glide.util.Util
类名称:Util
方法名:assertBackgroundThread
[英]Throws an java.lang.IllegalArgumentException if called on the main thread.
[中]抛出一个java。如果在主线程上调用lang.IllegalArgumentException。
代码示例来源:origin: bumptech/glide
/**
* Clears disk cache.
*
* <p>
* This method should always be called on a background thread, since it is a blocking call.
* </p>
*/
// Public API.
@SuppressWarnings({"unused", "WeakerAccess"})
public void clearDiskCache() {
Util.assertBackgroundThread();
engine.clearDiskCache();
}
代码示例来源:origin: bumptech/glide
private synchronized R doGet(Long timeoutMillis)
throws ExecutionException, InterruptedException, TimeoutException {
if (assertBackgroundThread && !isDone()) {
Util.assertBackgroundThread();
代码示例来源:origin: guolindev/giffun
/**
* Clears disk cache.
*
* <p>
* This method should always be called on a background thread, since it is a blocking call.
* </p>
*/
public void clearDiskCache() {
Util.assertBackgroundThread();
getEngine().clearDiskCache();
}
代码示例来源:origin: guolindev/giffun
private synchronized R doGet(Long timeoutMillis) throws ExecutionException, InterruptedException, TimeoutException {
if (assertBackgroundThread) {
Util.assertBackgroundThread();
}
if (isCancelled) {
throw new CancellationException();
} else if (exceptionReceived) {
throw new ExecutionException(exception);
} else if (resultReceived) {
return resource;
}
if (timeoutMillis == null) {
waiter.waitForTimeout(this, 0);
} else if (timeoutMillis > 0) {
waiter.waitForTimeout(this, timeoutMillis);
}
if (Thread.interrupted()) {
throw new InterruptedException();
} else if (exceptionReceived) {
throw new ExecutionException(exception);
} else if (isCancelled) {
throw new CancellationException();
} else if (!resultReceived) {
throw new TimeoutException();
}
return resource;
}
代码示例来源:origin: mozilla-tw/Rocket
/**
* Clears disk cache.
*
* <p>
* This method should always be called on a background thread, since it is a blocking call.
* </p>
*/
@SuppressWarnings("unused") // Public API
public void clearDiskCache() {
Util.assertBackgroundThread();
engine.clearDiskCache();
}
代码示例来源:origin: mozilla-tw/Rocket
private synchronized R doGet(Long timeoutMillis)
throws ExecutionException, InterruptedException, TimeoutException {
if (assertBackgroundThread && !isDone()) {
Util.assertBackgroundThread();
}
if (isCancelled) {
throw new CancellationException();
} else if (loadFailed) {
throw new ExecutionException(new IllegalStateException("Load failed"));
} else if (resultReceived) {
return resource;
}
if (timeoutMillis == null) {
waiter.waitForTimeout(this, 0);
} else if (timeoutMillis > 0) {
waiter.waitForTimeout(this, timeoutMillis);
}
if (Thread.interrupted()) {
throw new InterruptedException();
} else if (loadFailed) {
throw new ExecutionException(new IllegalStateException("Load failed"));
} else if (isCancelled) {
throw new CancellationException();
} else if (!resultReceived) {
throw new TimeoutException();
}
return resource;
}
内容来源于网络,如有侵权,请联系作者删除!