View Javadoc

1   /*
2    * $Id: Queue.java 22855 2011-09-04 17:45:44Z mike.schilling $
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  import org.mule.api.NamedObject;
14  import org.mule.api.store.ObjectStoreException;
15  
16  import java.io.Serializable;
17  
18  /**
19   * <code>Queue</code> TODO
20   */
21  public interface Queue extends NamedObject
22  {
23      /**
24       * Returns the number of elements in this queue.
25       */
26      int size();
27  
28      /**
29       * Puts a new object in this queue and wait if necessary.
30       */
31      void put(Serializable object) throws InterruptedException, ObjectStoreException;
32  
33      /**
34       * Blocks and retrieves an object from this queue.
35       *
36       * @return an object.
37       */
38      Serializable take() throws InterruptedException;
39  
40      void untake(Serializable item) throws InterruptedException, ObjectStoreException;
41  
42      Serializable peek() throws InterruptedException;
43  
44      Serializable poll(long timeout) throws InterruptedException;
45  
46      boolean offer(Serializable object, long timeout) throws InterruptedException, ObjectStoreException;
47  
48  }