MCPcopy Create free account
hub / github.com/diyhi/bbs / offer

Method offer

src/main/java/cms/utils/UniqueBlockingQueue.java:44–57  ·  view source on GitHub ↗
(T e)

Source from the content-addressed store, hash-verified

42 }
43
44 @Override
45 public synchronized boolean offer(T e) {
46 //接口描述表明,offer 只能因容量原因而失败,但我们是因唯一性原因而失败。
47 if (mElementSet.contains(e)) {
48 return false;
49 }
50
51
52 if (mBlockingQueue.offer(e)) {
53 mElementSet.add(e);
54 return true;
55 }
56 return false;
57 }
58
59 @Override
60 public synchronized boolean offer(T e, long timeout, TimeUnit unit) throws InterruptedException {

Callers 2

addHotTopicMethod · 0.80
addPVMethod · 0.80

Calls 2

containsMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected