本文整理了Java中java.util.concurrent.ThreadPoolExecutor.purge()
方法的一些代码示例,展示了ThreadPoolExecutor.purge()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadPoolExecutor.purge()
方法的具体详情如下:
包路径:java.util.concurrent.ThreadPoolExecutor
类名称:ThreadPoolExecutor
方法名:purge
[英]Tries to remove from the work queue all Futuretasks that have been cancelled. This method can be useful as a storage reclamation operation, that has no other impact on functionality. Cancelled tasks are never executed, but may accumulate in work queues until worker threads can actively remove them. Invoking this method instead tries to remove them now. However, this method may fail to remove tasks in the presence of interference by other threads.
[中]
代码示例来源:origin: aa112901/remusic
public static void finish() {
if(mInstance != null){
mInstance.mThreadPoolExec.shutdownNow();
mInstance.mThreadPoolExec.purge();
mInstance.mThreadPoolExec = null;
mInstance = null;
}
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void purgeThreadPool() {
threadPoolExecutor.purge();
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void purgeThreadPool() {
threadPoolExecutor.purge();
}
代码示例来源:origin: apache/phoenix
caches.clear();
if (cancelledWork) {
context.getConnection().getQueryServices().getExecutor().purge();
代码示例来源:origin: org.wisdom-framework/wisdom-executors
/**
* Tries to remove from the work queue all {@link java.util.concurrent.Future}
* tasks that have been cancelled. This method can be useful as a
* storage reclamation operation, that has no other impact on
* functionality. Cancelled tasks are never executed, but may
* accumulate in work queues until worker threads can actively
* remove them. Invoking this method instead tries to remove them now.
* However, this method may fail to remove tasks in
* the presence of interference by other threads.
*/
@Override
public synchronized void purge() {
internalPool.purge();
}
代码示例来源:origin: org.camunda.bpm/camunda-engine
public void purgeThreadPool() {
threadPoolExecutor.purge();
}
代码示例来源:origin: OpenLiberty/open-liberty
public boolean cancel()
{
if (_future.cancel(false))
{
_executor.purge();
return true;
}
return false;
}
}
代码示例来源:origin: org.apache.uima/uimaj-as-core
public void stop() {
if (executor != null) {
executor.purge();
executor.shutdownNow();
}
}
}
代码示例来源:origin: org.icepdf.os/icepdf-core
public static void shutdownThreadPool() {
// do a little clean up.
commonThreadPool.purge();
commonThreadPool.shutdownNow();
imageThreadPool.purge();
imageThreadPool.shutdownNow();
}
代码示例来源:origin: org.apache.uima/uimaj-as-core
public void stop() {
stopping = true;
semaphore.release(); // in case we are blocking on acquire
executor.purge();
executor.shutdownNow();
}
代码示例来源:origin: stackoverflow.com
public static ScheduledThreadPoolExecutor createSingleScheduledExecutor() {
final ScheduledThreadPoolExecutor executor
= new ScheduledThreadPoolExecutor(1);
Runnable task = new Runnable() {
@Override
public void run() {
executor.purge();
}
};
executor.scheduleWithFixedDelay(task, 30L, 30L, TimeUnit.SECONDS);
return executor;
}
代码示例来源:origin: apache/fluo
public void clear() {
tracker.clear();
executor.purge();
}
代码示例来源:origin: com.azaptree/azaptree-executor-service
@ManagedOperation(description = "Tries to remove from the work queue all Future tasks that have been cancelled.")
@Override
public void purge() {
super.purge();
}
代码示例来源:origin: org.apache.fluo/fluo-core
public void clear() {
tracker.clear();
executor.purge();
}
代码示例来源:origin: io.fluo/fluo-core
public void clear() {
tracker.clear();
executor.purge();
}
代码示例来源:origin: org.apache.uima/uimaj-as-core
public synchronized void stopIt() throws UimaSpiException {
if (stopping.get() == true) {
return;
}
stopping.set(true);
executor.purge();
executor.shutdownNow();
workQueue.clear();
Set<Entry<String, UimaVmMessageDispatcher>> set = dispatchers.entrySet();
for (Entry<String, UimaVmMessageDispatcher> entry : set) {
UimaVmMessageDispatcher dispatcher = entry.getValue();
dispatcher.stop();
}
}
代码示例来源:origin: cpesch/RouteConverter
public void stopDownloads(List<Download> downloads) {
for (Download download : downloads) {
if(COMPLETED.contains(download.getState()))
continue;
log.info("Stopping download " + download);
Future future = downloadToFutures.get(download);
if(future != null)
future.cancel(true);
DownloadExecutor executor = downloadToExecutors.get(download);
if(executor != null)
executor.stopped();
}
pool.purge();
}
代码示例来源:origin: neo4j-contrib/neo4j-graph-algorithms
private void stopFuturesAndStopScheduling(Collection<Future<Void>> futures) {
if (pool == null) {
stopFutures(futures);
return;
}
for (Future<Void> future : futures) {
if (future instanceof Runnable) {
pool.remove((Runnable) future);
}
future.cancel(true);
}
futures.clear();
pool.purge();
}
}
代码示例来源:origin: SMSTicket/sms-ticket
public void start() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
executor.purge(); // remove cancelled tasks
executeOnExecutor(executor);
} else {
execute();
}
}
代码示例来源:origin: Non-Dairy-Soy-Plugin/Non-Dairy-Soy-Plugin
public void flush() {
checkForErrors();
exec.purge();
checkForErrors();
}
内容来源于网络,如有侵权,请联系作者删除!