org.cruxframework.crux.core.client.executor
Class BeginEndExecutor

java.lang.Object
  extended by org.cruxframework.crux.core.client.executor.BeginEndExecutor

public abstract class BeginEndExecutor
extends Object

An executor that only executes the first and the last call to a given action. "Last call" means "the last call in N milliseconds", where N can be parameterized at the constructor. If there was only one call (begin call), a second one (end call) is emulated.

Author:
Gesse Dafe

Constructor Summary
BeginEndExecutor(int maxIntervalBetweenStartAndEnd)
          Creates an executor that only executes the first and the last call to a given action.
 
Method Summary
protected abstract  void doBeginAction()
          Called when the last call is made for the executor
protected abstract  void doEndAction()
          Called when the first call is made for the executor
 void execute()
          Throttles the invocations on the executor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeginEndExecutor

public BeginEndExecutor(int maxIntervalBetweenStartAndEnd)
Creates an executor that only executes the first and the last call to a given action.

Parameters:
end - if more than maxIntervalBetweenStartAndEnd milliseconds has passed since the previous call, considers that the current call is a begin call.
Method Detail

execute

public void execute()
Throttles the invocations on the executor


doEndAction

protected abstract void doEndAction()
Called when the first call is made for the executor


doBeginAction

protected abstract void doBeginAction()
Called when the last call is made for the executor



Copyright © 2014. All rights reserved.