org.teiid.jdbc
Class EnhancedTimer
java.lang.Object
org.teiid.jdbc.EnhancedTimer
public class EnhancedTimer
- extends Object
Specialized timer that can purge tasks in lg(n) time
Uses lock escalation to minimize contention for adding/removing tasks.
Will only hold a thread while there are pending tasks.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EnhancedTimer
public EnhancedTimer(String name)
- Constructs a new Timer that directly executes tasks off of a single-thread thread pool.
- Parameters:
name
-
EnhancedTimer
public EnhancedTimer(Executor bossExecutor,
Executor taskExecutor)
add
public EnhancedTimer.Task add(Runnable task,
long delay)
- Add a delayed task
- Parameters:
task
- delay
- in ms
- Returns:
- a cancellable Task
getQueueSize
public int getQueueSize()
Copyright © 2011. All Rights Reserved.