com.atlassian.crowd.manager.webhook
Class KeyedExecutor<K>

java.lang.Object
  extended by com.atlassian.crowd.manager.webhook.KeyedExecutor<K>

public class KeyedExecutor<K>
extends Object

A task executor that discards tasks if there is another existing task with the same key queued for execution. Keys must be valid Map keys, i.e., they must be immutable and have equals() and hashMap().

Since:
v2.7

Constructor Summary
KeyedExecutor(Executor delegateExecutor)
           
 
Method Summary
 void execute(Runnable runnable, K key)
          Adds a Runnable to the executor queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyedExecutor

public KeyedExecutor(Executor delegateExecutor)
Method Detail

execute

public void execute(Runnable runnable,
                    K key)
Adds a Runnable to the executor queue. If there is another Runnable with the same key that is awaiting its execution, then the new Runnable is discarded.

Parameters:
runnable - the runnable task.
key - task key. Must be immutable and have equals() and hashMap().


Copyright © 2014 Atlassian. All Rights Reserved.