Skip to content

Commit 5b4533a

Browse files
committed
Published with https://stackedit.io/
1 parent 88e6e83 commit 5b4533a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Java-Concurrency-Util/04.DelayQueue(延时队列).md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
04.DelayQueue(延时队列)
22

3-
*DelayQueue*类是*BlockingQueue*接口的实现类。*DelayQueue*类维护内部的元素直到特定的延时过期(The DelayQueue keeps the elements internally until a certain delay has expired.)。*DelayQueue*
4-
类里面的元素需要实现*java.util.concurrent.Delay*接口。下面是Delay接口的示例代码:
3+
DelayQueue class implements the BlockingQueue interface. Read the BlockingQueue text for more information about the interface.
4+
5+
The DelayQueue keeps the elements internally until a certain delay has expired. The elements must implement the interface java.util.concurrent.Delayed. Here is how the interface looks:
56

67
```Java
78
public interface Delayed extends Comparable<Delayed< {
@@ -10,7 +11,6 @@ public interface Delayed extends Comparable<Delayed< {
1011
```
1112

1213

13-
1414
The value returned by the getDelay() method should be the delay remaining before this element can be released. If 0 or a negative value is returned, the delay will be considered expired, and the element released at the next take() etc. call on the DelayQueue.
1515

1616
The TimeUnit instance passed to the getDelay() method is an Enum that tells which time unit the delay should be returned in. The TimeUnit enum can take these values:

0 commit comments

Comments
 (0)