本文整理汇总了Java中org.springframework.core.task.TaskRejectedException类的典型用法代码示例。如果您正苦于以下问题:Java TaskRejectedException类的具体用法?Java TaskRejectedException怎么用?Java TaskRejectedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TaskRejectedException类属于org.springframework.core.task包,在下文中一共展示了TaskRejectedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runDeadlockFuture
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
/**
* 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);
}
}
示例2: submitListenable
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}
示例3: submit
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}
示例4: submit
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}
示例5: submit
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
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);
}
}
示例6: submit
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}
示例7: execute
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}
示例8: submit
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}
示例9: execute
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}
示例10: submit
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}
示例11: submitListenable
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}
示例12: schedule
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}
示例13: scheduleAtFixedRate
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}
示例14: scheduleWithFixedDelay
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}
示例15: execute
import org.springframework.core.task.TaskRejectedException; //导入依赖的package包/类
@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);
}
}