* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
The implementation can both be synchronous or asynchronous, it can allocate specific threads or
share a pool of them between different instances.
The only requirement is that the specified execution is called each time a run method is invoked.
Note that, a proper asynchronous runner implementation will never synchronously run an execution, no matter the delay, unless it employs a single thread. While, a proper synchronous runner, will always run executions in the very same caller thread.
Note also that the runner methods can be called from different threads, so, it is up to the implementing class to ensure synchronization when required.
The implementing class can optionally support the cancellation of executions not yet run ( waiting, for example, in a consuming queue).
Created by davide-maestroni on 9/7/14.
method will never be called.
The implementation of this method is optional, still, it may greatly increase the performance
by avoiding to start invocations which are already canceled. The specific implementation can
safely ignore all that executions whose method
The implementation of this method is not strictly mandatory, even if, the classes always
returning false effectively prevent the correct detection of possible deadlocks.
A synchronous runner implementation will always return false.
method inside the runner thread).
delaythe execution delay.
timeUnitthe delay time unit.