textbender.o.awt
Class RunBuffer

java.lang.Object
  extended by RunBuffer
All Implemented Interfaces:
RunDelayer

@ThreadRestricted(value="AWT event dispatch")
public final class RunBuffer
extends Object
implements RunDelayer

A buffer for delayed and coalesced invocation of runnables. Use as a damper against rapid-fire events etc.


Constructor Summary
RunBuffer(int interInvocationMilliseconds)
          Creates a RunBuffer.
 
Method Summary
 int delayMillisecondsMinimum()
          Returns the minimum delay in milliseconds.
 void schedule(Runnable runnable)
          Ensures the run is scheduled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RunBuffer

public RunBuffer(int interInvocationMilliseconds)
Creates a RunBuffer.

Parameters:
interInvocationMilliseconds - delay between invocations of buffered runnables
Method Detail

delayMillisecondsMinimum

public int delayMillisecondsMinimum()
Description copied from interface: RunDelayer
Returns the minimum delay in milliseconds. The time between scheduling and eventual execution will not be less than this.

Specified by:
delayMillisecondsMinimum in interface RunDelayer

schedule

public void schedule(Runnable runnable)
Ensures the run is scheduled. If the same runnable was already scheduled but not yet executed, then no action is taken.

All runs will execute on the AWT event dispatch thread.

Specified by:
schedule in interface RunDelayer