亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? channel.java

?? 一個(gè)很好的微工作流內(nèi)核
?? JAVA
字號:
/*  File: Channel.java  Originally written by Doug Lea and released into the public domain.  This may be used for any purposes whatsoever without acknowledgment.  Thanks for the assistance and support of Sun Microsystems Labs,  and everyone contributing, testing, and using this code.  History:  Date       Who                What  11Jun1998  dl               Create public version  25aug1998  dl               added peek*/package EDU.oswego.cs.dl.util.concurrent;/**  * Main interface for buffers, queues, pipes, conduits, etc. * <p> * A Channel represents anything that you can put items * into and take them out of. As with the Sync  * interface, both * blocking (put(x), take), * and timeouts (offer(x, msecs), poll(msecs)) policies * are provided. Using a * zero timeout for offer and poll results in a pure balking policy. * <p> * To aid in efforts to use Channels in a more typesafe manner, * this interface extends Puttable and Takable. You can restrict * arguments of instance variables to this type as a way of * guaranteeing that producers never try to take, or consumers put. * for example: * <pre> * class Producer implements Runnable { *   final Puttable chan; *   Producer(Puttable channel) { chan = channel; } *   public void run() { *     try { *       for(;;) { chan.put(produce()); } *     } *     catch (InterruptedException ex) {} *   } *   Object produce() { ... } * } * * * class Consumer implements Runnable { *   final Takable chan; *   Consumer(Takable channel) { chan = channel; } *   public void run() { *     try { *       for(;;) { consume(chan.take()); } *     } *     catch (InterruptedException ex) {} *   } *   void consume(Object x) { ... } * } * * class Setup { *   void main() { *     Channel chan = new SomeChannelImplementation(); *     Producer p = new Producer(chan); *     Consumer c = new Consumer(chan); *     new Thread(p).start(); *     new Thread(c).start(); *   } * } * </pre> * <p> * A given channel implementation might or might not have bounded * capacity or other insertion constraints, so in general, you cannot tell if * a given put will block. However, * Channels that are designed to  * have an element capacity (and so always block when full) * should implement the  * BoundedChannel  * subinterface. * <p> * Channels may hold any kind of item. However, * insertion of null is not in general supported. Implementations * may (all currently do) throw IllegalArgumentExceptions upon attempts to * insert null.  * <p> * By design, the Channel interface does not support any methods to determine * the current number of elements being held in the channel. * This decision reflects the fact that in * concurrent programming, such methods are so rarely useful * that including them invites misuse; at best they could  * provide a snapshot of current * state, that could change immediately after being reported. * It is better practice to instead use poll and offer to try * to take and put elements without blocking. For example, * to empty out the current contents of a channel, you could write: * <pre> *  try { *    for (;;) { *       Object item = channel.poll(0); *       if (item != null) *         process(item); *       else *         break; *    } *  } *  catch(InterruptedException ex) { ... } * </pre> * <p> * However, it is possible to determine whether an item * exists in a Channel via <code>peek</code>, which returns * but does NOT remove the next item that can be taken (or null * if there is no such item). The peek operation has a limited * range of applicability, and must be used with care. Unless it * is known that a given thread is the only possible consumer * of a channel, and that no time-out-based <code>offer</code> operations * are ever invoked, there is no guarantee that the item returned * by peek will be available for a subsequent take. * <p> * When appropriate, you can define an isEmpty method to * return whether <code>peek</code> returns null. * <p> * Also, as a compromise, even though it does not appear in interface, * implementation classes that can readily compute the number * of elements support a <code>size()</code> method. This allows careful * use, for example in queue length monitors, appropriate to the * particular implementation constraints and properties. * <p> * All channels allow multiple producers and/or consumers. * They do not support any kind of <em>close</em> method * to shut down operation or indicate completion of particular * producer or consumer threads.  * If you need to signal completion, one way to do it is to * create a class such as * <pre> * class EndOfStream {  *    // Application-dependent field/methods * } * </pre> * And to have producers put an instance of this class into * the channel when they are done. The consumer side can then * check this via * <pre> *   Object x = aChannel.take(); *   if (x instanceof EndOfStream)  *     // special actions; perhaps terminate *   else *     // process normally * </pre> * <p> * In time-out based methods (poll(msecs) and offer(x, msecs),  * time bounds are interpreted in * a coarse-grained, best-effort fashion. Since there is no * way in Java to escape out of a wait for a synchronized * method/block, time bounds can sometimes be exceeded when * there is a lot contention for the channel. Additionally, * some Channel semantics entail a ``point of * no return'' where, once some parts of the operation have completed, * others must follow, regardless of time bound. * <p> * Interruptions are in general handled as early as possible * in all methods. Normally, InterruptionExceptions are thrown * in put/take and offer(msec)/poll(msec) if interruption * is detected upon entry to the method, as well as in any * later context surrounding waits.  * <p> * If a put returns normally, an offer * returns true, or a put or poll returns non-null, the operation * completed successfully.  * In all other cases, the operation fails cleanly -- the * element is not put or taken. * <p> * As with Sync classes, spinloops are not directly supported, * are not particularly recommended for routine use, but are not hard  * to construct. For example, here is an exponential backoff version: * <pre> * Object backOffTake(Channel q) throws InterruptedException { *   long waitTime = 0; *   for (;;) { *      Object x = q.poll(0); *      if (x != null) *        return x; *      else { *        Thread.sleep(waitTime); *        waitTime = 3 * waitTime / 2 + 1; *      } *    } * </pre> * <p> * <b>Sample Usage</b>. Here is a producer/consumer design * where the channel is used to hold Runnable commands representing * background tasks. * <pre> * class Service { *   private final Channel channel = ... some Channel implementation; *   *   private void backgroundTask(int taskParam) { ... } * *   public void action(final int arg) { *     Runnable command =  *       new Runnable() { *         public void run() { backgroundTask(arg); } *       }; *     try { channel.put(command) } *     catch (InterruptedException ex) { *       Thread.currentThread().interrupt(); // ignore but propagate *     } *   } *  *   public Service() { *     Runnable backgroundLoop =  *       new Runnable() { *         public void run() { *           for (;;) { *             try { *               Runnable task = (Runnable)(channel.take()); *               task.run(); *             } *             catch (InterruptedException ex) { return; } *           } *         } *       }; *     new Thread(backgroundLoop).start(); *   } * } *     * </pre> * <p>[<a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html"> Introduction to this package. </a>] * @see Sync  * @see BoundedChannel **/public interface Channel extends Puttable, Takable {  /**    * Place item in the channel, possibly waiting indefinitely until   * it can be accepted. Channels implementing the BoundedChannel   * subinterface are generally guaranteed to block on puts upon   * reaching capacity, but other implementations may or may not block.   * @param item the element to be inserted. Should be non-null.   * @exception InterruptedException if the current thread has   * been interrupted at a point at which interruption   * is detected, in which case the element is guaranteed not   * to be inserted. Otherwise, on normal return, the element is guaranteed   * to have been inserted.  **/  public void put(Object item) throws InterruptedException;  /**    * Place item in channel only if it can be accepted within   * msecs milliseconds. The time bound is interpreted in   * a coarse-grained, best-effort fashion.    * @param item the element to be inserted. Should be non-null.   * @param msecs the number of milliseconds to wait. If less than   * or equal to zero, the method does not perform any timed waits,   * but might still require   * access to a synchronization lock, which can impose unbounded   * delay if there is a lot of contention for the channel.   * @return true if accepted, else false   * @exception InterruptedException if the current thread has   * been interrupted at a point at which interruption   * is detected, in which case the element is guaranteed not   * to be inserted (i.e., is equivalent to a false return).  **/  public boolean offer(Object item, long msecs) throws InterruptedException;  /**    * Return and remove an item from channel,    * possibly waiting indefinitely until   * such an item exists.   * @return  some item from the channel. Different implementations   *  may guarantee various properties (such as FIFO) about that item   * @exception InterruptedException if the current thread has   * been interrupted at a point at which interruption   * is detected, in which case state of the channel is unchanged.   *  **/  public Object take() throws InterruptedException;  /**    * Return and remove an item from channel only if one is available within   * msecs milliseconds. The time bound is interpreted in a coarse   * grained, best-effort fashion.   * @param msecs the number of milliseconds to wait. If less than   *  or equal to zero, the operation does not perform any timed waits,   * but might still require   * access to a synchronization lock, which can impose unbounded   * delay if there is a lot of contention for the channel.   * @return some item, or null if the channel is empty.   * @exception InterruptedException if the current thread has   * been interrupted at a point at which interruption   * is detected, in which case state of the channel is unchanged   * (i.e., equivalent to a null return).  **/  public Object poll(long msecs) throws InterruptedException;  /**   * Return, but do not remove object at head of Channel,   * or null if it is empty.   **/  public Object peek();}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级搡bbbb搡bbbb| 亚洲欧美国产毛片在线| 国产日本欧洲亚洲| 亚洲日本免费电影| 老司机精品视频导航| 91一区一区三区| 日韩欧美国产一区二区在线播放| 国产日韩欧美综合一区| 亚洲老司机在线| 国产一区啦啦啦在线观看| 91国产成人在线| 日韩欧美国产三级电影视频| 中文字幕五月欧美| 另类小说图片综合网| 在线观看国产日韩| 亚洲国产cao| 风间由美一区二区三区在线观看 | 欧美乱妇20p| 国产精品青草久久| 日韩福利视频网| 欧美日韩在线综合| 亚洲私人黄色宅男| 成人av第一页| 精品国产三级a在线观看| 午夜伊人狠狠久久| 色综合天天视频在线观看| 久久久天堂av| 激情综合色播激情啊| 555夜色666亚洲国产免| 夜夜嗨av一区二区三区中文字幕 | 欧美性受xxxx黑人xyx性爽| 国产欧美一区二区精品忘忧草| 日韩欧美亚洲一区二区| 国产精品成人一区二区艾草| 国产精品白丝av| 日韩视频一区二区三区在线播放| 欧美va亚洲va在线观看蝴蝶网| 日韩精品一区二区三区视频| 亚洲1区2区3区视频| 欧美自拍偷拍一区| 亚洲欧洲精品一区二区三区| 成人精品gif动图一区| 久久精品人人做人人爽97| 国产永久精品大片wwwapp| 26uuu国产日韩综合| 黄色资源网久久资源365| 精品国产亚洲一区二区三区在线观看| 国产精品色婷婷久久58| 风流少妇一区二区| 欧美经典三级视频一区二区三区| 一区二区三区资源| 日韩视频一区在线观看| 玖玖九九国产精品| 久久一日本道色综合| 国产福利一区二区三区视频在线 | 日韩一级完整毛片| 国产一区二区伦理| 国产精品灌醉下药二区| 色综合天天综合色综合av| 一区二区三区四区亚洲| 欧美日韩精品一区二区三区| 日韩av网站免费在线| 久久久亚洲午夜电影| 不卡视频在线看| 亚洲国产精品久久久男人的天堂| 国产精品一区二区免费不卡 | 成人黄色综合网站| 亚洲精品一二三区| 欧美精品久久久久久久多人混战 | 色综合中文字幕国产| 亚洲欧洲美洲综合色网| 欧美婷婷六月丁香综合色| 蜜桃一区二区三区四区| 精品国产百合女同互慰| 91在线看国产| 91在线国产观看| 美日韩一区二区三区| 欧美国产禁国产网站cc| 欧美三级在线视频| 国产suv一区二区三区88区| 亚洲精品国产一区二区三区四区在线| 国产乱码精品一区二区三区av| 欧美精品一级二级| 国产精品一级片| 亚洲与欧洲av电影| 日韩欧美美女一区二区三区| 97se亚洲国产综合自在线不卡 | 日本人妖一区二区| 国产精品萝li| 51午夜精品国产| 成人av先锋影音| 九九视频精品免费| 亚洲黄一区二区三区| 久久久国际精品| 欧美精品tushy高清| 97精品久久久久中文字幕| 久久av中文字幕片| 亚洲成人动漫在线免费观看| 中文av一区二区| 日韩欧美国产精品一区| 欧美日韩一级二级三级| 99热这里都是精品| 国产成人在线视频网址| 全部av―极品视觉盛宴亚洲| 一区二区成人在线| 国产精品美日韩| 久久综合九色综合97婷婷| 欧美一区二区三区视频| 欧美综合久久久| 91免费看片在线观看| 国产+成+人+亚洲欧洲自线| 捆绑调教一区二区三区| 日韩黄色免费网站| 亚瑟在线精品视频| 一级做a爱片久久| 一区二区三区四区在线免费观看| 欧美日韩在线电影| 精品国产91亚洲一区二区三区婷婷 | 日韩一级完整毛片| 日韩一区二区免费在线电影| 欧美少妇性性性| 欧美日韩国产成人在线免费| 在线一区二区三区做爰视频网站| 性做久久久久久| 无码av免费一区二区三区试看| 欧美二区三区91| 欧美日韩黄色一区二区| 日本韩国欧美一区二区三区| 色中色一区二区| 色婷婷久久综合| 欧美日韩一区二区欧美激情| 在线观看91精品国产入口| 欧美亚洲禁片免费| 在线视频一区二区三| 欧美色图一区二区三区| 欧美巨大另类极品videosbest| 日韩成人一级大片| 毛片不卡一区二区| 久久99精品久久只有精品| 国产一区二区三区| av一区二区三区| 欧美亚洲综合色| 欧美妇女性影城| 久久九九国产精品| 亚洲人一二三区| 午夜电影久久久| 国产精品456| 色美美综合视频| 欧美成人精品1314www| 国产亚洲欧美在线| 一区二区三区在线高清| 日本人妖一区二区| 成人h精品动漫一区二区三区| 青青草伊人久久| 国产ts人妖一区二区| 色欧美88888久久久久久影院| 国模无码大尺度一区二区三区| 亚洲韩国一区二区三区| 蜜桃一区二区三区在线| 成人蜜臀av电影| 欧美网站一区二区| 久久精品网站免费观看| 亚洲一二三四在线| 国产激情精品久久久第一区二区| 免费久久99精品国产| 国产一区 二区 三区一级| 一本到高清视频免费精品| 日韩午夜三级在线| 亚洲精品视频在线观看网站| 喷白浆一区二区| 91网站最新地址| 久久综合狠狠综合久久激情 | 综合色天天鬼久久鬼色| 日韩av一级电影| 91小视频在线| 久久久青草青青国产亚洲免观| 91精品国产福利| 国产欧美日韩视频在线观看| 日日骚欧美日韩| av高清久久久| 久久综合九色综合欧美98| 日韩综合小视频| 在线观看av不卡| 亚洲免费看黄网站| 国产xxx精品视频大全| 精品久久久三级丝袜| 亚洲成人综合网站| 99精品热视频| 国产片一区二区| 国产一区二区在线观看视频| 欧美精品777| 午夜一区二区三区在线观看| 色美美综合视频| 亚洲欧美日韩精品久久久久| 国产aⅴ精品一区二区三区色成熟| 国产不卡视频一区| 欧美videos大乳护士334| 午夜亚洲福利老司机| 在线精品视频免费观看| 一区在线播放视频|