Mercurial > hg > blitz_condensed
view src/EDU/oswego/cs/dl/util/concurrent/misc/FIFOSlot.java @ 34:6f68e94c1fb8 default tip
Add CondensedStats monitoring utility, equivalent to vmstat
author | Dominic Cleal <dominic-cleal@cdo2.com> |
---|---|
date | Thu, 05 Aug 2010 11:07:25 +0100 |
parents | 3dc0c5604566 |
children |
line wrap: on
line source
package EDU.oswego.cs.dl.util.concurrent.misc; import EDU.oswego.cs.dl.util.concurrent.*; // demo showing one way to make special channels public class FIFOSlot implements BoundedChannel { private final Slot slot_; public FIFOSlot() { try { slot_ = new Slot(FIFOSemaphore.class); } catch (Exception ex) { ex.printStackTrace(); throw new Error("Cannot make Slot?"); } } public void put(Object item) throws InterruptedException { slot_.put(item); } public boolean offer(Object item, long msecs) throws InterruptedException { return slot_.offer(item, msecs); } public Object take() throws InterruptedException { return slot_.take(); } public Object poll(long msecs) throws InterruptedException { return slot_.poll(msecs); } public int capacity() { return 1; } public Object peek() { return slot_.peek(); } }