1 /* 2 * $Id: Queue.java 7976 2007-08-21 14:26:13Z dirk.olmes $ 3 * -------------------------------------------------------------------------------------- 4 * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.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 * @return 23 */ 24 int size(); 25 26 /** 27 * Puts a new object in this queue and wait if necessary. 28 * 29 * @param o the object to put 30 */ 31 void put(Object o) throws InterruptedException; 32 33 /** 34 * Blocks and retrieves an object from this queue. 35 * 36 * @return an object. 37 */ 38 Object take() 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 }