org.omnaest.utils.operation.special
Class OperationBlockingToFastRepeatingExecutions<RESULT,PARAMETER>
java.lang.Object
org.omnaest.utils.operation.special.OperationBlockingToFastRepeatingExecutions<RESULT,PARAMETER>
- Type Parameters:
RESULT - PARAMETER -
- All Implemented Interfaces:
- Operation<RESULT,PARAMETER>
public class OperationBlockingToFastRepeatingExecutions<RESULT,PARAMETER>
- extends Object
- implements Operation<RESULT,PARAMETER>
Operation which will allow to execute the execute(Object) method only once within a given period of time. All
faster reinvoked execute(Object) calls will result in an OperationBlockingToFastRepeatingExecutions.ToFastInvocationException.
- Author:
- Omnaest
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
operation
protected Operation<RESULT,PARAMETER> operation
maximumNumberOfToleratedTooFastInvocations
protected int maximumNumberOfToleratedTooFastInvocations
minimalDurationBetweenExecutionInMilliseconds
protected long minimalDurationBetweenExecutionInMilliseconds
forcedDurationAfterToFastInvocationInMilliseconds
protected long forcedDurationAfterToFastInvocationInMilliseconds
lastInvocationExceededMinimalDurationBetweenTwoExcecutionCalls
protected boolean lastInvocationExceededMinimalDurationBetweenTwoExcecutionCalls
durationCapture
protected DurationCapture durationCapture
alreadyToleratedToFastInvocations
protected long alreadyToleratedToFastInvocations
OperationBlockingToFastRepeatingExecutions
public OperationBlockingToFastRepeatingExecutions(Operation<RESULT,PARAMETER> operation,
long minimalDurationBetweenExecutionInMilliseconds,
long forcedDurationAfterToFastInvocationInMilliseconds)
- Parameters:
operation - minimalDurationBetweenExecutionInMilliseconds - forcedDurationAfterToFastInvocationInMilliseconds -
OperationBlockingToFastRepeatingExecutions
public OperationBlockingToFastRepeatingExecutions(Operation<RESULT,PARAMETER> operation,
int maximumNumberOfToleratedTooFastInvocations,
long minimalDurationBetweenExecutionInMilliseconds,
long forcedDurationAfterToFastInvocationInMilliseconds)
- Parameters:
operation - maximumNumberOfToleratedTooFastInvocations - minimalDurationBetweenExecutionInMilliseconds - forcedDurationAfterToFastInvocationInMilliseconds - - See Also:
OperationBlockingToFastRepeatingExecutions
execute
public RESULT execute(PARAMETER parameter)
- Specified by:
execute in interface Operation<RESULT,PARAMETER>
hasLastInvocationExceededMinimalDurationBetweenTwoExcecutionCalls
public boolean hasLastInvocationExceededMinimalDurationBetweenTwoExcecutionCalls()
- Returns true if the next
execute(Object) will be forced to wait for
forcedDurationAfterToFastInvocationInMilliseconds
- Returns:
Copyright © 2013. All Rights Reserved.