public class SeckillQueue extends Object
Modifier and Type | Method and Description |
---|---|
SuccessKilled |
consume() |
static SeckillQueue |
getMailQueue() |
Boolean |
produce(SuccessKilled kill)
生产入队
|
int |
size() |
public static SeckillQueue getMailQueue()
public Boolean produce(SuccessKilled kill) throws InterruptedException
kill
- InterruptedException
- add(e) 队列未满时,返回true;队列满则抛出IllegalStateException(“Queue full”)异常——AbstractQueue
put(e) 队列未满时,直接插入没有返回值;队列满时会阻塞等待,一直等到队列未满时再插入。
offer(e) 队列未满时,返回true;队列满时返回false。非阻塞立即返回。
offer(e, time, unit) 设定等待的时间,如果在指定时间内还不能往队列中插入数据则返回false,插入成功返回true。public SuccessKilled consume() throws InterruptedException
InterruptedException
public int size()
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.