List of usage examples for java.util.concurrent RunnableFuture toString
public String toString()
From source file:org.mule.service.scheduler.internal.executor.ByCallerThrottlingPolicy.java
public void throttle(Runnable throttledCallback, RunnableFuture<?> task, ThrottledScheduler scheduler) { ThreadGroup currentThreadGroup = currentThread().getThreadGroup(); ++rejectedCount;//from ww w . j ava 2 s. c o m if (!isSchedulerThread(currentThreadGroup) || isWaitGroupThread(currentThreadGroup)) { try { synchronized (runningTasks) { runningTasks.incrementAndGet(); while (runningTasks.get() > maxConcurrentTasks) { if (isLogThrottleEnabled()) { logThrottle(task.toString(), "WaitPolicy", scheduler.toString()); } runningTasks.wait(); } } throttledCallback.run(); } catch (InterruptedException e) { currentThread().interrupt(); throw new MuleRuntimeException(e); } } else { synchronized (runningTasks) { if (runningTasks.incrementAndGet() > maxConcurrentTasks) { if (isLogThrottleEnabled()) { logThrottle(task.toString(), "AbortPolicy", scheduler.toString()); } throw new SchedulerTaskThrottledException( "Task '" + task.toString() + "' throttled back from '" + scheduler.toString() + "'"); } else { throttledCallback.run(); } } } }