View Javadoc

1   /*
2    * $Id: QueueInfoDelegate.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  package org.mule.util.queue;
11  
12  import org.mule.api.store.ObjectStoreException;
13  
14  import java.io.Serializable;
15  
16  /**
17   * A QueueInfo delegates the actual work of processing its queue to one of these.
18   */
19  public interface QueueInfoDelegate
20  {
21      /**
22       * append a new member to the end of the queue
23       */
24      void putNow(Serializable o);
25  
26      /**
27       * Offer to append a new member to the end of the queue
28       */
29      boolean offer(Serializable o, int room, long timeout) throws InterruptedException, ObjectStoreException;
30  
31      /**
32       * Poll the queue for its first member, and, if there is one, remove and return it
33       */
34      Serializable poll(long timeout) throws InterruptedException;
35  
36      /**
37       * return, but do not remove, the first member of the queue
38       */
39      Serializable peek() throws InterruptedException;
40  
41      /**
42       * Restore a previously removed member to the front of the queue
43       */
44      void untake(Serializable item) throws InterruptedException, ObjectStoreException;
45  
46      /**
47       * Return the size of the queue
48       */
49      int getSize();
50  }