Package org.apache.shenyu.common.timer
Class TimerTaskList
- java.lang.Object
-
- org.apache.shenyu.common.timer.TimerTaskList
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTimerTaskList.TimerTaskEntryThe type Timer task entry.
-
Constructor Summary
Constructors Constructor Description TimerTaskList(java.util.concurrent.atomic.AtomicInteger taskCounter)Instantiates a new Timer task list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(TimerTaskList.TimerTaskEntry timerTaskEntry)Add.intcompareTo(java.util.concurrent.Delayed delayed)voidforeach(java.util.function.Consumer<TimerTask> consumer)Traversing using this is thread-safe.longgetDelay(java.util.concurrent.TimeUnit unit)longgetExpiration()Get the bucket's expiration time.java.util.Iterator<TimerTask>iterator()Using Iterator is not thread safe.voidremove(TimerTaskList.TimerTaskEntry timerTaskEntry)Remove.booleansetExpiration(long expirationMs)Sets expiration.
-
-
-
Method Detail
-
setExpiration
public boolean setExpiration(long expirationMs)
Sets expiration.- Parameters:
expirationMs- the expiration ms- Returns:
- the expiration
-
getExpiration
public long getExpiration()
Get the bucket's expiration time.- Returns:
- the expiration
-
add
public void add(TimerTaskList.TimerTaskEntry timerTaskEntry)
Add.- Parameters:
timerTaskEntry- the timer task entry
-
foreach
public void foreach(java.util.function.Consumer<TimerTask> consumer)
Traversing using this is thread-safe.- Parameters:
consumer- the consumer
-
getDelay
public long getDelay(java.util.concurrent.TimeUnit unit)
- Specified by:
getDelayin interfacejava.util.concurrent.Delayed
-
compareTo
public int compareTo(java.util.concurrent.Delayed delayed)
- Specified by:
compareToin interfacejava.lang.Comparable<java.util.concurrent.Delayed>
-
remove
public void remove(TimerTaskList.TimerTaskEntry timerTaskEntry)
Remove.- Parameters:
timerTaskEntry- the timer task entry
-
-