Java 类org.springframework.core.task.TaskRejectedException 实例源码

项目:dhus-core    文件:FairThreadPoolTaskExecutor.java   
@Override
public ListenableFuture<?> submitListenable (Runnable task)
{
   ExecutorService executor = getThreadPoolExecutor ();
   try
   {
      ListenableFutureTask<Object> future =
         new ListenableFutureTask<Object> (task, null);
      executor.execute (future);
      return future;
   }
   catch (RejectedExecutionException ex)
   {
      throw new TaskRejectedException ("Executor [" + executor +
         "] did not accept task: " + task, ex);
   }
}
项目:dhus-core    文件:FairThreadPoolTaskExecutor.java   
@Override
public <T> ListenableFuture<T> submitListenable (Callable<T> task)
{
   ExecutorService executor = getThreadPoolExecutor ();
   try
   {
      ListenableFutureTask<T> future = new ListenableFutureTask<T> (task);
      executor.execute (future);
      return future;
   }
   catch (RejectedExecutionException ex)
   {
      throw new TaskRejectedException ("Executor [" + executor +
         "] did not accept task: " + task, ex);
   }
}
项目:spring4-understanding    文件:TaskExecutorAdapter.java   
@Override
public Future<?> submit(Runnable task) {
    try {
        if (this.concurrentExecutor instanceof ExecutorService) {
            return ((ExecutorService) this.concurrentExecutor).submit(task);
        }
        else {
            FutureTask<Object> future = new FutureTask<Object>(task, null);
            this.concurrentExecutor.execute(future);
            return future;
        }
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException(
                "Executor [" + this.concurrentExecutor + "] did not accept task: " + task, ex);
    }
}
项目:spring4-understanding    文件:TaskExecutorAdapter.java   
@Override
public <T> Future<T> submit(Callable<T> task) {
    try {
        if (this.concurrentExecutor instanceof ExecutorService) {
            return ((ExecutorService) this.concurrentExecutor).submit(task);
        }
        else {
            FutureTask<T> future = new FutureTask<T>(task);
            this.concurrentExecutor.execute(future);
            return future;
        }
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException(
                "Executor [" + this.concurrentExecutor + "] did not accept task: " + task, ex);
    }
}
项目:spring    文件:TaskExecutorAdapter.java   
@Override
public Future<?> submit(Runnable task) {
    try {
        if (this.taskDecorator == null && this.concurrentExecutor instanceof ExecutorService) {
            return ((ExecutorService) this.concurrentExecutor).submit(task);
        }
        else {
            FutureTask<Object> future = new FutureTask<Object>(task, null);
            doExecute(this.concurrentExecutor, this.taskDecorator, future);
            return future;
        }
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException(
                "Executor [" + this.concurrentExecutor + "] did not accept task: " + task, ex);
    }
}
项目:spring    文件:TaskExecutorAdapter.java   
@Override
public <T> Future<T> submit(Callable<T> task) {
    try {
        if (this.taskDecorator == null && this.concurrentExecutor instanceof ExecutorService) {
            return ((ExecutorService) this.concurrentExecutor).submit(task);
        }
        else {
            FutureTask<T> future = new FutureTask<T>(task);
            doExecute(this.concurrentExecutor, this.taskDecorator, future);
            return future;
        }
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException(
                "Executor [" + this.concurrentExecutor + "] did not accept task: " + task, ex);
    }
}
项目:DataHubSystem    文件:FairThreadPoolTaskExecutor.java   
@Override
public ListenableFuture<?> submitListenable (Runnable task)
{
   ExecutorService executor = getThreadPoolExecutor ();
   try
   {
      ListenableFutureTask<Object> future =
         new ListenableFutureTask<Object> (task, null);
      executor.execute (future);
      return future;
   }
   catch (RejectedExecutionException ex)
   {
      throw new TaskRejectedException ("Executor [" + executor +
         "] did not accept task: " + task, ex);
   }
}
项目:DataHubSystem    文件:FairThreadPoolTaskExecutor.java   
@Override
public <T> ListenableFuture<T> submitListenable (Callable<T> task)
{
   ExecutorService executor = getThreadPoolExecutor ();
   try
   {
      ListenableFutureTask<T> future = new ListenableFutureTask<T> (task);
      executor.execute (future);
      return future;
   }
   catch (RejectedExecutionException ex)
   {
      throw new TaskRejectedException ("Executor [" + executor +
         "] did not accept task: " + task, ex);
   }
}
项目:class-guard    文件:TaskExecutorAdapter.java   
public Future<?> submit(Runnable task) {
    try {
        if (this.concurrentExecutor instanceof ExecutorService) {
            return ((ExecutorService) this.concurrentExecutor).submit(task);
        }
        else {
            FutureTask<Object> future = new FutureTask<Object>(task, null);
            this.concurrentExecutor.execute(future);
            return future;
        }
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException(
                "Executor [" + this.concurrentExecutor + "] did not accept task: " + task, ex);
    }
}
项目:class-guard    文件:TaskExecutorAdapter.java   
public <T> Future<T> submit(Callable<T> task) {
    try {
        if (this.concurrentExecutor instanceof ExecutorService) {
            return ((ExecutorService) this.concurrentExecutor).submit(task);
        }
        else {
            FutureTask<T> future = new FutureTask<T>(task);
            this.concurrentExecutor.execute(future);
            return future;
        }
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException(
                "Executor [" + this.concurrentExecutor + "] did not accept task: " + task, ex);
    }
}
项目:spring-scheduling-sr    文件:TaskExecutorAdapter.java   
@Override
public Future<?> submit(Runnable task) {
    try {
        if (this.concurrentExecutor instanceof ExecutorService) { // 为"执行器服务"类实例
            return ((ExecutorService) this.concurrentExecutor).submit(task);
        }
        else { // 否则,使用一个"可取消的异步计算任务(FutureTask)"执行任务
            FutureTask<Object> future = new FutureTask<Object>(task, null);
            this.concurrentExecutor.execute(future);
            return future;
        }
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException(
                "Executor [" + this.concurrentExecutor + "] did not accept task: " + task, ex);
    }
}
项目:spring-scheduling-sr    文件:TaskExecutorAdapter.java   
@Override
public <T> Future<T> submit(Callable<T> task) {
    try {
        if (this.concurrentExecutor instanceof ExecutorService) { // 为"执行器服务"类实例
            return ((ExecutorService) this.concurrentExecutor).submit(task);
        }
        else { // 否则,使用一个"可取消的异步计算任务(FutureTask)"执行任务
            FutureTask<T> future = new FutureTask<T>(task);
            this.concurrentExecutor.execute(future);
            return future;
        }
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException(
                "Executor [" + this.concurrentExecutor + "] did not accept task: " + task, ex);
    }
}
项目:red5-server-common    文件:ReceivedMessageTask.java   
/**
 * Runs deadlock guard task
 *
 * @param deadlockGuardTask
 *            deadlock guard task
 */
@SuppressWarnings("unchecked")
public void runDeadlockFuture(Runnable deadlockGuardTask) {
    if (deadlockFuture == null) {
        ThreadPoolTaskScheduler deadlockGuard = conn.getDeadlockGuardScheduler();
        if (deadlockGuard != null) {
            try {
                deadlockFuture = (ScheduledFuture<Runnable>) deadlockGuard.schedule(deadlockGuardTask, new Date(packet.getExpirationTime()));
            } catch (TaskRejectedException e) {
                log.warn("DeadlockGuard task is rejected for {}", sessionId, e);
            }
        } else {
            log.debug("Deadlock guard is null for {}", sessionId);
        }
    } else {
        log.warn("Deadlock future is already create for {}", sessionId);
    }
}
项目:dhus-core    文件:FairThreadPoolTaskExecutor.java   
@Override
public void execute (Runnable task)
{
   Executor executor = getThreadPoolExecutor ();
   try
   {
      executor.execute (task);
   }
   catch (RejectedExecutionException ex)
   {
      throw new TaskRejectedException ("Executor [" + executor +
         "] did not accept task: " + task, ex);
   }
}
项目:dhus-core    文件:FairThreadPoolTaskExecutor.java   
@Override
public Future<?> submit (Runnable task)
{
   ExecutorService executor = getThreadPoolExecutor ();
   try
   {
      return executor.submit (task);
   }
   catch (RejectedExecutionException ex)
   {
      throw new TaskRejectedException ("Executor [" + executor +
         "] did not accept task: " + task, ex);
   }
}
项目:dhus-core    文件:FairThreadPoolTaskExecutor.java   
@Override
public <T> Future<T> submit (Callable<T> task)
{
   ExecutorService executor = getThreadPoolExecutor ();
   try
   {
      return executor.submit (task);
   }
   catch (RejectedExecutionException ex)
   {
      throw new TaskRejectedException ("Executor [" + executor +
         "] did not accept task: " + task, ex);
   }
}
项目:lams    文件:ThreadPoolTaskExecutor.java   
@Override
public void execute(Runnable task) {
    Executor executor = getThreadPoolExecutor();
    try {
        executor.execute(task);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskExecutor.java   
@Override
public Future<?> submit(Runnable task) {
    ExecutorService executor = getThreadPoolExecutor();
    try {
        return executor.submit(task);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskExecutor.java   
@Override
public <T> Future<T> submit(Callable<T> task) {
    ExecutorService executor = getThreadPoolExecutor();
    try {
        return executor.submit(task);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskExecutor.java   
@Override
public ListenableFuture<?> submitListenable(Runnable task) {
    ExecutorService executor = getThreadPoolExecutor();
    try {
        ListenableFutureTask<Object> future = new ListenableFutureTask<Object>(task, null);
        executor.execute(future);
        return future;
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskExecutor.java   
@Override
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
    ExecutorService executor = getThreadPoolExecutor();
    try {
        ListenableFutureTask<T> future = new ListenableFutureTask<T>(task);
        executor.execute(future);
        return future;
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ConcurrentTaskScheduler.java   
@Override
public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
    try {
        if (this.enterpriseConcurrentScheduler) {
            return new EnterpriseConcurrentTriggerScheduler().schedule(decorateTask(task, true), trigger);
        }
        else {
            ErrorHandler errorHandler = (this.errorHandler != null ? this.errorHandler : TaskUtils.getDefaultErrorHandler(true));
            return new ReschedulingRunnable(task, trigger, this.scheduledExecutor, errorHandler).schedule();
        }
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ConcurrentTaskScheduler.java   
@Override
public ScheduledFuture<?> schedule(Runnable task, Date startTime) {
    long initialDelay = startTime.getTime() - System.currentTimeMillis();
    try {
        return this.scheduledExecutor.schedule(decorateTask(task, false), initialDelay, TimeUnit.MILLISECONDS);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ConcurrentTaskScheduler.java   
@Override
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Date startTime, long period) {
    long initialDelay = startTime.getTime() - System.currentTimeMillis();
    try {
        return this.scheduledExecutor.scheduleAtFixedRate(decorateTask(task, true), initialDelay, period, TimeUnit.MILLISECONDS);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ConcurrentTaskScheduler.java   
@Override
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long period) {
    try {
        return this.scheduledExecutor.scheduleAtFixedRate(decorateTask(task, true), 0, period, TimeUnit.MILLISECONDS);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ConcurrentTaskScheduler.java   
@Override
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Date startTime, long delay) {
    long initialDelay = startTime.getTime() - System.currentTimeMillis();
    try {
        return this.scheduledExecutor.scheduleWithFixedDelay(decorateTask(task, true), initialDelay, delay, TimeUnit.MILLISECONDS);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ConcurrentTaskScheduler.java   
@Override
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long delay) {
    try {
        return this.scheduledExecutor.scheduleWithFixedDelay(decorateTask(task, true), 0, delay, TimeUnit.MILLISECONDS);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskScheduler.java   
@Override
public void execute(Runnable task) {
    Executor executor = getScheduledExecutor();
    try {
        executor.execute(errorHandlingTask(task, false));
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskScheduler.java   
@Override
public Future<?> submit(Runnable task) {
    ExecutorService executor = getScheduledExecutor();
    try {
        return executor.submit(errorHandlingTask(task, false));
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskScheduler.java   
@Override
public <T> Future<T> submit(Callable<T> task) {
    ExecutorService executor = getScheduledExecutor();
    try {
        Callable<T> taskToUse = task;
        if (this.errorHandler != null) {
            taskToUse = new DelegatingErrorHandlingCallable<T>(task, this.errorHandler);
        }
        return executor.submit(taskToUse);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskScheduler.java   
@Override
public ListenableFuture<?> submitListenable(Runnable task) {
    ExecutorService executor = getScheduledExecutor();
    try {
        ListenableFutureTask<Object> future = new ListenableFutureTask<Object>(task, null);
        executor.execute(errorHandlingTask(future, false));
        return future;
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskScheduler.java   
@Override
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
    ExecutorService executor = getScheduledExecutor();
    try {
        ListenableFutureTask<T> future = new ListenableFutureTask<T>(task);
        executor.execute(errorHandlingTask(future, false));
        return future;
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskScheduler.java   
@Override
public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
    ScheduledExecutorService executor = getScheduledExecutor();
    try {
        ErrorHandler errorHandler =
                (this.errorHandler != null ? this.errorHandler : TaskUtils.getDefaultErrorHandler(true));
        return new ReschedulingRunnable(task, trigger, executor, errorHandler).schedule();
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskScheduler.java   
@Override
public ScheduledFuture<?> schedule(Runnable task, Date startTime) {
    ScheduledExecutorService executor = getScheduledExecutor();
    long initialDelay = startTime.getTime() - System.currentTimeMillis();
    try {
        return executor.schedule(errorHandlingTask(task, false), initialDelay, TimeUnit.MILLISECONDS);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskScheduler.java   
@Override
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Date startTime, long period) {
    ScheduledExecutorService executor = getScheduledExecutor();
    long initialDelay = startTime.getTime() - System.currentTimeMillis();
    try {
        return executor.scheduleAtFixedRate(errorHandlingTask(task, true), initialDelay, period, TimeUnit.MILLISECONDS);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskScheduler.java   
@Override
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long period) {
    ScheduledExecutorService executor = getScheduledExecutor();
    try {
        return executor.scheduleAtFixedRate(errorHandlingTask(task, true), 0, period, TimeUnit.MILLISECONDS);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskScheduler.java   
@Override
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Date startTime, long delay) {
    ScheduledExecutorService executor = getScheduledExecutor();
    long initialDelay = startTime.getTime() - System.currentTimeMillis();
    try {
        return executor.scheduleWithFixedDelay(errorHandlingTask(task, true), initialDelay, delay, TimeUnit.MILLISECONDS);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:lams    文件:ThreadPoolTaskScheduler.java   
@Override
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long delay) {
    ScheduledExecutorService executor = getScheduledExecutor();
    try {
        return executor.scheduleWithFixedDelay(errorHandlingTask(task, true), 0, delay, TimeUnit.MILLISECONDS);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}
项目:flow-platform    文件:YmlServiceImpl.java   
@Override
public Node startLoad(final Node root, final Consumer<Yml> onSuccess, final Consumer<Throwable> onError) {
    if (!EnvUtil.hasRequiredEnvKey(root, GitService.REQUIRED_ENVS)) {
        throw new IllegalParameterException("Missing git settings: FLOW_GIT_URL and FLOW_GIT_SOURCE");
    }

    if (isYmlLoading(root)) {
        throw new IllegalStatusException("Yml file is loading");
    }

    // update FLOW_YML_STATUS to LOADING
    nodeService.updateYmlState(root, YmlStatusValue.GIT_CONNECTING, null);

    try {
        ThreadPoolTaskExecutor executor = findThreadPoolFromCache(root.getPath());

        // async to load yml file
        executor.execute(new UpdateNodeYmlTask(root, nodeService, gitService, onSuccess, onError));
    } catch (ExecutionException | TaskRejectedException e) {
        LOGGER.warn("Fail to get task executor for node: " + root.getPath());
        nodeService.updateYmlState(root, YmlStatusValue.ERROR, e.getMessage());

        if (onError != null) {
            onError.accept(e);
        }
    }

    return root;
}
项目:spring4-understanding    文件:ThreadPoolTaskExecutor.java   
@Override
public void execute(Runnable task) {
    Executor executor = getThreadPoolExecutor();
    try {
        executor.execute(task);
    }
    catch (RejectedExecutionException ex) {
        throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
    }
}