View Javadoc

1   /*
2    * $Id: Queue.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.util.queue;
12  
13  /**
14   * <code>Queue</code> TODO
15   */
16  public interface Queue
17  {
18  
19      /**
20       * Returns the number of elements in this queue.
21       */
22      int size();
23  
24      /**
25       * Puts a new object in this queue and wait if necessary.
26       * 
27       * @param o the object to put
28       */
29      void put(Object o) throws InterruptedException;
30  
31      /**
32       * Blocks and retrieves an object from this queue.
33       * 
34       * @return an object.
35       */
36      Object take() throws InterruptedException;
37  
38      void untake(Object item) throws InterruptedException;
39  
40      Object peek() throws InterruptedException;
41  
42      Object poll(long timeout) throws InterruptedException;
43  
44      boolean offer(Object o, long timeout) throws InterruptedException;
45  
46      String getName();
47  }