java.util.concurrent.ThreadPoolExecutor.newTaskFor()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中java.util.concurrent.ThreadPoolExecutor.newTaskFor()方法的一些代码示例,展示了ThreadPoolExecutor.newTaskFor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadPoolExecutor.newTaskFor()方法的具体详情如下:
包路径:java.util.concurrent.ThreadPoolExecutor
类名称:ThreadPoolExecutor
方法名:newTaskFor

ThreadPoolExecutor.newTaskFor介绍

暂无

代码示例

代码示例来源:origin: Netflix/hollow

@Override
protected final <T> RunnableFuture<T> newTaskFor(final Runnable runnable, final T value) {
  final RunnableFuture<T> task = super.newTaskFor(runnable, value);
  futures.add(task);
  return task;
}

代码示例来源:origin: Netflix/hollow

@Override
protected final <T> RunnableFuture<T> newTaskFor(final Callable<T> callable) {
  final RunnableFuture<T> task = super.newTaskFor(callable);
  futures.add(task);
  return task;
}

代码示例来源:origin: com.github.workerframework/worker-core

@Override
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value)
{
  RunnableFuture<T> runnableFuture = super.newTaskFor(runnable, value);
  tasks.put(runnableFuture, runnable);
  return runnableFuture;
}

代码示例来源:origin: GoSimpleLLC/jpgAgent

return super.newTaskFor(callable);

代码示例来源:origin: org.geoserver.importer/gs-importer-core

protected <T extends Object> RunnableFuture<T> newTaskFor(Callable<T> callable) {
  if (callable instanceof Job) {
    return new Task((Job) callable);
  }
  return super.newTaskFor(callable);
};

代码示例来源:origin: org.glassfish.main.ejb/ejb-container

/**
 * Ensure that we give out our EjbFutureTask as opposed to JDK's FutureTask
 * @param callable
 * @return a RunnableFuture
 */
@Override
protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable) {
  if (callable instanceof EjbAsyncTask) {
    return ((EjbAsyncTask) callable).getFutureTask();
  }
  return super.newTaskFor(callable);
}

代码示例来源:origin: org.geoserver.importer/importer-core

protected <T extends Object> RunnableFuture<T> newTaskFor(Callable<T> callable) {
  if (callable instanceof Job) {
    return new Task((Job) callable);
  }
  return super.newTaskFor(callable);
};

代码示例来源:origin: org.jppf/jppf-common

@Override
 protected <T> RunnableFuture<T> newTaskFor(final Runnable runnable, final T value) {
  final RunnableFuture<T> future = super.newTaskFor(runnable, value);
  if (runnable instanceof NodeTaskWrapper) ((NodeTaskWrapper) runnable).setFuture(future);
  return future;
 }
};

代码示例来源:origin: omero/server

/**
 * Overrides {@link ThreadPoolExecutor} to return our own instance of
 * {@link FutureTask} so that we have a marker for when the background
 * activity is completed in {@link #afterExecute(Runnable, Throwable)}.
 *
 * Overriding this method is somewhat non-standard.
 */
@Override
protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable) {
  if (callable instanceof BackgroundCallable) {
    BackgroundCallable<?> background = (BackgroundCallable<?>) callable;
    return new BackgroundFutureTask(background.delegate);
  }
  return super.newTaskFor(callable);
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

@Override
protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
{
  if (isTracing() && !(callable instanceof LocalSessionWrapper))
  {
    return new LocalSessionWrapper<T>(callable);
  }
  return super.newTaskFor(callable);
}

代码示例来源:origin: jsevellec/cassandra-unit

@Override
protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
{
  if (isTracing() && !(callable instanceof LocalSessionWrapper))
  {
    return new LocalSessionWrapper<T>(callable);
  }
  return super.newTaskFor(callable);
}

代码示例来源:origin: org.jcodec/jcodec

protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable) {
    RunnableFuture<T> newTaskFor = super.newTaskFor(callable);
    return new PriorityFuture<T>(newTaskFor, ((PriorityCallable<T>) callable).getPriority());
  }
};

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

@Override
protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
{
  if (isTracing() && !(callable instanceof LocalSessionWrapper))
  {
    return new LocalSessionWrapper<T>(callable);
  }
  return super.newTaskFor(callable);
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

@Override
protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
{
  if (isTracing() && !(callable instanceof TraceSessionWrapper))
  {
    return new TraceSessionWrapper<T>(callable);
  }
  return super.newTaskFor(callable);
}

代码示例来源:origin: jsevellec/cassandra-unit

@Override
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T result)
{
  if (isTracing() && !(runnable instanceof LocalSessionWrapper))
  {
    return new LocalSessionWrapper<T>(Executors.callable(runnable, result));
  }
  return super.newTaskFor(runnable, result);
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

@Override
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T result)
{
  if (isTracing() && !(runnable instanceof LocalSessionWrapper))
  {
    return new LocalSessionWrapper<T>(Executors.callable(runnable, result));
  }
  return super.newTaskFor(runnable, result);
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

@Override
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T result)
{
  if (isTracing() && !(runnable instanceof TraceSessionWrapper))
  {
    return new TraceSessionWrapper<T>(Executors.callable(runnable, result));
  }
  return super.newTaskFor(runnable, result);
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

@Override
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T result)
{
  if (isTracing() && !(runnable instanceof LocalSessionWrapper))
  {
    return new LocalSessionWrapper<T>(Executors.callable(runnable, result));
  }
  return super.newTaskFor(runnable, result);
}

代码示例来源:origin: SmartDataAnalytics/DL-Learner

@Override
  protected RunnableFuture newTaskFor(Callable callable) {
    if (callable instanceof PathDetectionTask) {
      return ((PathDetectionTask) callable).newTask();
    } else {
      return super.newTaskFor(callable); // A regular Callable, delegate to parent
    }
  }
}

代码示例来源:origin: SmartDataAnalytics/DL-Learner

@Override
  protected RunnableFuture newTaskFor(Callable callable) {
    if (callable instanceof PathDetectionTask) {
      return ((PathDetectionTask) callable).newTask();
    } else {
      return super.newTaskFor(callable); // A regular Callable, delegate to parent
    }
  }
}

相关文章

ThreadPoolExecutor类方法