blob: ec345855423ce3ea1406b44652b893d804a80128 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_09) on Fri Apr 20 10:10:35 CDT 2007 -->
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>
Queue (OpenJPA 0.9.7-incubating API)
</TITLE>
<META NAME="keywords" CONTENT="org.apache.openjpa.lib.util.concurrent.Queue interface">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Queue (OpenJPA 0.9.7-incubating API)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Queue.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/NanoTimer.html" title="interface in org.apache.openjpa.lib.util.concurrent"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/ReentrantLock.html" title="class in org.apache.openjpa.lib.util.concurrent"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/openjpa/lib/util/concurrent/Queue.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Queue.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.openjpa.lib.util.concurrent</FONT>
<BR>
Interface Queue</H2>
<DL>
<DT><B>All Superinterfaces:</B> <DD><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html" title="class or interface in java.util">Collection</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Iterable.html" title="class or interface in java.lang">Iterable</A></DD>
</DL>
<DL>
<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/ConcurrentLinkedQueue.html" title="class in org.apache.openjpa.lib.util.concurrent">ConcurrentLinkedQueue</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public interface <B>Queue</B><DT>extends <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html" title="class or interface in java.util">Collection</A></DL>
</PRE>
<P>
A collection designed for holding elements prior to processing.
Besides basic <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html" title="class or interface in java.util"><CODE>Collection</CODE></A> operations,
queues provide additional insertion, extraction, and inspection
operations. Each of these methods exists in two forms: one throws
an exception if the operation fails, the other returns a special
value(either <tt>null</tt> or <tt>false</tt>, depending on the
operation). The latter form of the insert operation is designed
specifically for use with capacity-restricted <tt>Queue</tt>
implementations; in most implementations, insert operations cannot fail.
<table BORDER CELLPADDING=3 CELLSPACING=1>
<tr>
<td></td>
<td ALIGN=CENTER><em>Throws exception</em></td>
<td ALIGN=CENTER><em>Returns special value</em></td>
</tr>
<tr>
<td><b>Insert</b></td>
<td><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#add(java.lang.Object)"><CODE>add(e)</CODE></A></td>
<td><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#offer(java.lang.Object)"><CODE>offer(e)</CODE></A></td>
</tr>
<tr>
<td><b>Remove</b></td>
<td><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#remove()"><CODE>remove()</CODE></A></td>
<td><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#poll()"><CODE>poll()</CODE></A></td>
</tr>
<tr>
<td><b>Examine</b></td>
<td><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#element()"><CODE>element()</CODE></A></td>
<td><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#peek()"><CODE>peek()</CODE></A></td>
</tr>
</table> Queues typically, but do not necessarily, order elements in a
FIFO(first-in-first-out) manner. Among the exceptions are
priority queues, which order elements according to a supplied
comparator, or the elements' natural ordering, and LIFO queues(or
stacks) which order the elements LIFO(last-in-first-out).
Whatever the ordering used, the <em>head</em> of the queue is that
element which would be removed by a call to <A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#remove()"><CODE>remove()</CODE></A> or
<A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#poll()"><CODE>poll()</CODE></A>. In a FIFO queue, all new elements are inserted at
the <em> tail</em> of the queue. Other kinds of queues may use
different placement rules. Every <tt>Queue</tt> implementation
must specify its ordering properties.
The <A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#offer(java.lang.Object)"><CODE>offer</CODE></A> method inserts an element if possible,
otherwise returning <tt>false</tt>. This differs from the <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#add(E)" title="class or interface in java.util"><CODE>Collection.add</CODE></A> method, which can fail to
add an element only by throwing an unchecked exception. The
<tt>offer</tt> method is designed for use when failure is a normal,
rather than exceptional occurrence, for example, in fixed-capacity
(or &quot;bounded&quot;) queues.
The <A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#remove()"><CODE>remove()</CODE></A> and <A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#poll()"><CODE>poll()</CODE></A> methods remove and
return the head of the queue.
Exactly which element is removed from the queue is a
function of the queue's ordering policy, which differs from
implementation to implementation. The <tt>remove()</tt> and
<tt>poll()</tt> methods differ only in their behavior when the
queue is empty: the <tt>remove()</tt> method throws an exception,
while the <tt>poll()</tt> method returns <tt>null</tt>.
The <A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#element()"><CODE>element()</CODE></A> and <A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#peek()"><CODE>peek()</CODE></A> methods return, but do
not remove, the head of the queue.
The <tt>Queue</tt> interface does not define the <i>blocking queue
methods</i>, which are common in concurrent programming. These methods,
which wait for elements to appear or for space to become available, are
defined in the <CODE>edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue</CODE> interface, which
extends this interface.
<tt>Queue</tt> implementations generally do not allow insertion
of <tt>null</tt> elements, although some implementations, such as
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/LinkedList.html" title="class or interface in java.util"><CODE>LinkedList</CODE></A>, do not prohibit insertion of <tt>null</tt>.
Even in the implementations that permit it, <tt>null</tt> should
not be inserted into a <tt>Queue</tt>, as <tt>null</tt> is also
used as a special return value by the <tt>poll</tt> method to
indicate that the queue contains no elements.
<tt>Queue</tt> implementations generally do not define
element-based versions of methods <tt>equals</tt> and
<tt>hashCode</tt> but instead inherit the identity based versions
from class <tt>Object</tt>, because element-based equality is not
always well-defined for queues with the same elements but different
ordering properties.
This interface is a member of the
<a href="../../../../../../../guide/collections/index.html">
Java Collections Framework</a>.
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>1.5</DD>
<DT><B>Author:</B></DT>
<DD>Doug Lea</DD>
<DT><B>See Also:</B><DD><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html" title="class or interface in java.util"><CODE>Collection</CODE></A>,
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/LinkedList.html" title="class or interface in java.util"><CODE>LinkedList</CODE></A>,
<CODE>PriorityQueue</CODE>,
<CODE>edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue</CODE>,
<CODE>edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue</CODE>,
<CODE>edu.emory.mathcs.backport.java.util.concurrent.ArrayBlockingQueue</CODE>,
<CODE>edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue</CODE>,
<CODE>edu.emory.mathcs.backport.java.util.concurrent.PriorityBlockingQueue</CODE></DL>
<HR>
<P>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#add(java.lang.Object)">add</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;e)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Inserts the specified element into this queue if it is possible to do so
immediately without violating capacity restrictions, returning
<tt>true</tt> upon success and throwing an <tt>IllegalStateException</tt>
if no space is currently available.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#element()">element</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves, but does not remove, the head of this queue.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#offer(java.lang.Object)">offer</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;e)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Inserts the specified element into this queue if it is possible to do
so immediately without violating capacity restrictions.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#peek()">peek</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves, but does not remove, the head of this queue,
or returns <tt>null</tt> if this queue is empty.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#poll()">poll</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves and removes the head of this queue,
or returns <tt>null</tt> if this queue is empty.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#remove()">remove</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves and removes the head of this queue.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.util.Collection"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from interface java.util.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html" title="class or interface in java.util">Collection</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#addAll(java.util.Collection)" title="class or interface in java.util">addAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#clear()" title="class or interface in java.util">clear</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#contains(java.lang.Object)" title="class or interface in java.util">contains</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#containsAll(java.util.Collection)" title="class or interface in java.util">containsAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#equals(java.lang.Object)" title="class or interface in java.util">equals</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#hashCode()" title="class or interface in java.util">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#isEmpty()" title="class or interface in java.util">isEmpty</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#iterator()" title="class or interface in java.util">iterator</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#remove(java.lang.Object)" title="class or interface in java.util">remove</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#removeAll(java.util.Collection)" title="class or interface in java.util">removeAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#retainAll(java.util.Collection)" title="class or interface in java.util">retainAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#size()" title="class or interface in java.util">size</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#toArray()" title="class or interface in java.util">toArray</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#toArray(T[])" title="class or interface in java.util">toArray</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="add(java.lang.Object)"><!-- --></A><H3>
add</H3>
<PRE>
boolean <B>add</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;e)</PRE>
<DL>
<DD>Inserts the specified element into this queue if it is possible to do so
immediately without violating capacity restrictions, returning
<tt>true</tt> upon success and throwing an <tt>IllegalStateException</tt>
if no space is currently available.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#add(E)" title="class or interface in java.util">add</A></CODE> in interface <CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html" title="class or interface in java.util">Collection</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>e</CODE> - the element to add
<DT><B>Returns:</B><DD><tt>true</tt> (as specified by <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html#add(E)" title="class or interface in java.util"><CODE>Collection.add(E)</CODE></A>)
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the element cannot be added at this
time due to capacity restrictions
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassCastException.html" title="class or interface in java.lang">ClassCastException</A></CODE> - if the class of the specified element
prevents it from being added to this queue
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang">NullPointerException</A></CODE> - if the specified element is null and
this queue not permit null elements
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if some property of this element
prevents it from being added to this queue</DL>
</DD>
</DL>
<HR>
<A NAME="offer(java.lang.Object)"><!-- --></A><H3>
offer</H3>
<PRE>
boolean <B>offer</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;e)</PRE>
<DL>
<DD>Inserts the specified element into this queue if it is possible to do
so immediately without violating capacity restrictions.
When using a capacity-restricted queue, this method is generally
preferable to <A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#add(java.lang.Object)"><CODE>add(java.lang.Object)</CODE></A>, which can fail to insert an element only
by throwing an exception.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>e</CODE> - the element to add
<DT><B>Returns:</B><DD><tt>true</tt> if the element was added to this queue, else
<tt>false</tt>
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassCastException.html" title="class or interface in java.lang">ClassCastException</A></CODE> - if the class of the specified element
prevents it from being added to this queue
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang">NullPointerException</A></CODE> - if the specified element is null and
this queue does not permit null elements
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if some property of this element
prevents it from being added to this queue</DL>
</DD>
</DL>
<HR>
<A NAME="remove()"><!-- --></A><H3>
remove</H3>
<PRE>
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>remove</B>()</PRE>
<DL>
<DD>Retrieves and removes the head of this queue. This method differs
from <A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#poll()"><CODE>poll</CODE></A> only in that it throws an exception if this
queue is empty. is empty.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the head of this queue
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/NoSuchElementException.html" title="class or interface in java.util">NoSuchElementException</A></CODE> - if this queue is empty</DL>
</DD>
</DL>
<HR>
<A NAME="poll()"><!-- --></A><H3>
poll</H3>
<PRE>
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>poll</B>()</PRE>
<DL>
<DD>Retrieves and removes the head of this queue,
or returns <tt>null</tt> if this queue is empty.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the head of this queue, or <tt>null</tt> if this queue is empty</DL>
</DD>
</DL>
<HR>
<A NAME="element()"><!-- --></A><H3>
element</H3>
<PRE>
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>element</B>()</PRE>
<DL>
<DD>Retrieves, but does not remove, the head of this queue. This method
differs from <A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/Queue.html#peek()"><CODE>peek</CODE></A> only in that it throws an exception
if this queue is empty.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the head of this queue
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/NoSuchElementException.html" title="class or interface in java.util">NoSuchElementException</A></CODE> - if this queue is empty</DL>
</DD>
</DL>
<HR>
<A NAME="peek()"><!-- --></A><H3>
peek</H3>
<PRE>
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>peek</B>()</PRE>
<DL>
<DD>Retrieves, but does not remove, the head of this queue,
or returns <tt>null</tt> if this queue is empty.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the head of this queue, or <tt>null</tt> if this queue is empty</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Queue.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/NanoTimer.html" title="interface in org.apache.openjpa.lib.util.concurrent"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../../org/apache/openjpa/lib/util/concurrent/ReentrantLock.html" title="class in org.apache.openjpa.lib.util.concurrent"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/openjpa/lib/util/concurrent/Queue.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Queue.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright &copy; 2006-2007 <a href="http://www.apache.org">Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>