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

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

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

ScheduledThreadPoolExecutor.submit介绍

暂无

代码示例

代码示例来源:origin: netty/netty

@Override
public <T> Future<T> submit(Runnable task, T result) {
  return (Future<T>) super.submit(task, result);
}

代码示例来源:origin: netty/netty

@Override
public <T> Future<T> submit(Callable<T> task) {
  return (Future<T>) super.submit(task);
}

代码示例来源:origin: netty/netty

@Override
public Future<?> submit(Runnable task) {
  return (Future<?>) super.submit(task);
}

代码示例来源:origin: redisson/redisson

@Override
public Future<?> submit(Runnable task) {
  return (Future<?>) super.submit(task);
}

代码示例来源:origin: redisson/redisson

@Override
public <T> Future<T> submit(Callable<T> task) {
  return (Future<T>) super.submit(task);
}

代码示例来源:origin: redisson/redisson

@Override
public <T> Future<T> submit(Runnable task, T result) {
  return (Future<T>) super.submit(task, result);
}

代码示例来源:origin: wildfly/wildfly

@Override
public <T> Future<T> submit(Runnable task, T result) {
  return (Future<T>) super.submit(task, result);
}

代码示例来源:origin: wildfly/wildfly

@Override
public <T> Future<T> submit(Callable<T> task) {
  return (Future<T>) super.submit(task);
}

代码示例来源:origin: wildfly/wildfly

@Override
public Future<?> submit(Runnable task) {
  return (Future<?>) super.submit(task);
}

代码示例来源:origin: spotbugs/spotbugs

@ExpectWarning("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
public  void test(ScheduledThreadPoolExecutor service, Callable<T> callable, Runnable runnable, T value) {
  service.submit(callable);
  service.submit(runnable);
  service.submit(runnable, value);
}
@ExpectWarning("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")

代码示例来源:origin: twitter/distributedlog

@Override
public <T> Future<T> submit(Runnable task, T result) {
  return super.submit(timedRunnable(task), result);
}

代码示例来源:origin: twitter/distributedlog

@Override
public Future<?> submit(Runnable task) {
  return super.submit(timedRunnable(task));
}

代码示例来源:origin: twitter/distributedlog

@Override
public <T> Future<T> submit(Callable<T> task) {
  return super.submit(timedCallable(task));
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Render this state. Should be invoked only by a subclass or by the
 * AppStateManager. Invoked once per frame, provided the state is attached
 * and enabled.
 *
 * @param rm the render manager (not null)
 */
public void render(RenderManager rm) {
  if (!active) {
    return;
  }
  if (threadingType == ThreadingType.PARALLEL) {
    physicsFuture = executor.submit(parallelPhysicsUpdate);
  } else if (threadingType == ThreadingType.SEQUENTIAL) {
    pSpace.update(active ? tpf * speed : 0);
  } else {
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Render this state. Should be invoked only by a subclass or by the
 * AppStateManager. Invoked once per frame, provided the state is attached
 * and enabled.
 *
 * @param rm the render manager (not null)
 */
public void render(RenderManager rm) {
  if (!active) {
    return;
  }
  if (threadingType == ThreadingType.PARALLEL) {
    physicsFuture = executor.submit(parallelPhysicsUpdate);
  } else if (threadingType == ThreadingType.SEQUENTIAL) {
    pSpace.update(active ? tpf * speed : 0);
  } else {
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Allocate the physics space and start physics for ThreadingType.PARALLEL.
 *
 * @return true if successful, otherwise false
 */
private boolean startPhysicsOnExecutor() {
  if (executor != null) {
    executor.shutdown();
  }
  executor = new ScheduledThreadPoolExecutor(1);
  final BulletAppState app = this;
  Callable<Boolean> call = new Callable<Boolean>() {
    public Boolean call() throws Exception {
      detachedPhysicsLastUpdate = System.currentTimeMillis();
      pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType);
      pSpace.addTickListener(app);
      return true;
    }
  };
  try {
    return executor.submit(call).get();
  } catch (InterruptedException ex) {
    Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex);
    return false;
  } catch (ExecutionException ex) {
    Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex);
    return false;
  }
}
private Callable<Boolean> parallelPhysicsUpdate = new Callable<Boolean>() {

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Allocate the physics space and start physics for ThreadingType.PARALLEL.
 *
 * @return true if successful, otherwise false
 */
private boolean startPhysicsOnExecutor() {
  if (executor != null) {
    executor.shutdown();
  }
  executor = new ScheduledThreadPoolExecutor(1);
  final BulletAppState app = this;
  Callable<Boolean> call = new Callable<Boolean>() {
    public Boolean call() throws Exception {
      detachedPhysicsLastUpdate = System.currentTimeMillis();
      pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType);
      pSpace.addTickListener(app);
      return true;
    }
  };
  try {
    return executor.submit(call).get();
  } catch (InterruptedException ex) {
    Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex);
    return false;
  } catch (ExecutionException ex) {
    Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex);
    return false;
  }
}
private Callable<Boolean> parallelPhysicsUpdate = new Callable<Boolean>() {

代码示例来源:origin: alibaba/Sentinel

private static void scheduleNextRollingTask(StatLogger statLogger) {
  if (!running.get()) {
    EagleEye.selfLog("[INFO] stopped rolling statLogger[" + statLogger.getLoggerName() + "]");
    return;
  }
  StatLogRollingTask rollingTask = new StatLogRollingTask(statLogger);
  long rollingTimeMillis = statLogger.getRollingData().getRollingTimeMillis();
  long delayMillis = rollingTimeMillis - System.currentTimeMillis();
  if (delayMillis > 5) {
    rollerThreadPool.schedule(rollingTask, delayMillis, TimeUnit.MILLISECONDS);
  } else if (-delayMillis > statLogger.getIntervalMillis()) {
    EagleEye.selfLog("[WARN] unusual delay of statLogger[" + statLogger.getLoggerName() +
      "], delay=" + (-delayMillis) + "ms, submit now");
    rollerThreadPool.submit(rollingTask);
  } else {
    rollerThreadPool.submit(rollingTask);
  }
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * Schedule to given task on the disk writer executor service.
 *
 * @param <U> return type of the callable
 * @param call callable to call
 * @return Future representing the return of this call
 */
protected <U> Future<U> schedule(Callable<U> call) {
  return diskWriter.submit(call);
}

代码示例来源:origin: io.netty/netty-common

@Override
public <T> Future<T> submit(Runnable task, T result) {
  return (Future<T>) super.submit(task, result);
}

相关文章

微信公众号

最新文章

更多

ScheduledThreadPoolExecutor类方法