📄 unbiasedqueue.synchronizedqueue.html
字号:
Returns an array of objects, possibly empty, from the queue.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.SynchronizedQueue.html#push(java.lang.Object)">push</A></B>(java.lang.Object obj)</CODE><BR> Attempt to push an object onto the queue. If the queue is full then the object will not be pushed. This method does not use any synchronization and should not be used if other threads are using <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pop(long)"><CODE>UnbiasedQueue.pop(long)</CODE></A> to retrieve elements.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.SynchronizedQueue.html#push(java.lang.Object, long)">push</A></B>(java.lang.Object obj, long timeout)</CODE><BR> Push an object onto the queue. If the queue is full then the push will wait for up to "timeout" milliseconds to push the object. At the end of "timeout" milliseconds, the push will either return false or remove the oldest item from the queue and insert "obj". This behaviour is contolled by the constructor parameter "dropOldest".</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.SynchronizedQueue.html#pushBack(java.lang.Object)">pushBack</A></B>(java.lang.Object obj)</CODE><BR> Attempt to push an object back at the head the queue. If the queue is full then the object will not be pushed. This method does not use any synchronization and should not be used if other threads are using <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pop(long)"><CODE>UnbiasedQueue.pop(long)</CODE></A> to retrieve elements.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.SynchronizedQueue.html#pushBack(java.lang.Object, long)">pushBack</A></B>(java.lang.Object obj, long timeout)</CODE><BR> Push an object back at the head of the queue. If the queue is full then the push will wait for up to "timeout" milliseconds to push the object. At the end of "timeout" milliseconds, the push will either return false or remove the oldest item from the queue and insert "obj". This behaviour is contolled by the constructor parameter "dropOldest". <p/>Timeout control is accomplished via synchronization and <CODE>Object.wait(long)</CODE>. <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pushBack(java.lang.Object, long)"><CODE>UnbiasedQueue.pushBack(Object,long)</CODE></A> should only be used in conjunction with <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#push(java.lang.Object, long)"><CODE>UnbiasedQueue.push(Object,long)</CODE></A> and <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pop(long)"><CODE>UnbiasedQueue.pop(long)</CODE></A></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.SynchronizedQueue.html#setMaxQueueSize(int)">setMaxQueueSize</A></B>(int maxObjs)</CODE><BR> Set how many objects this queue may store. Note that if there are more objects already in the queue than the specified amount then the queue will retain its current capacity.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_net.jxta.impl.util.UnbiasedQueue"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class net.jxta.impl.util.<A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html" title="class in net.jxta.impl.util">UnbiasedQueue</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#synchronizedQueue(net.jxta.impl.util.UnbiasedQueue)">synchronizedQueue</A>, <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#toString()">toString</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.Object</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="innerqueue"><!-- --></A><H3>innerqueue</H3><PRE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html" title="class in net.jxta.impl.util">UnbiasedQueue</A> <B>innerqueue</B></PRE><DL><DL></DL></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="UnbiasedQueue.SynchronizedQueue(net.jxta.impl.util.UnbiasedQueue)"><!-- --></A><H3>UnbiasedQueue.SynchronizedQueue</H3><PRE>public <B>UnbiasedQueue.SynchronizedQueue</B>(<A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html" title="class in net.jxta.impl.util">UnbiasedQueue</A> queue)</PRE><DL><DD>{@inheritDoc}<P></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="isClosed()"><!-- --></A><H3>isClosed</H3><PRE>public boolean <B>isClosed</B>()</PRE><DL><DD>Atomically return whether or not this queue has been closed. Closed queues will not accept "push" requests, but elements will still be returned with "pop".<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#isClosed()">isClosed</A></CODE> in class <CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html" title="class in net.jxta.impl.util">UnbiasedQueue</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>boolean indicating whether this queue has been closed.</DL></DD></DL><HR><A NAME="close()"><!-- --></A><H3>close</H3><PRE>public void <B>close</B>()</PRE><DL><DD>Close the queue. This will prevent any further objects from being enqueued.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#close()">close</A></CODE> in class <CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html" title="class in net.jxta.impl.util">UnbiasedQueue</A></CODE></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="clear()"><!-- --></A><H3>clear</H3><PRE>public void <B>clear</B>()</PRE><DL><DD>Flush the queue of all pending objects.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#clear()">clear</A></CODE> in class <CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html" title="class in net.jxta.impl.util">UnbiasedQueue</A></CODE></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="push(java.lang.Object)"><!-- --></A><H3>push</H3><PRE>public boolean <B>push</B>(java.lang.Object obj)</PRE><DL><DD>Attempt to push an object onto the queue. If the queue is full then the object will not be pushed. This method does not use any synchronization and should not be used if other threads are using <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pop(long)"><CODE>UnbiasedQueue.pop(long)</CODE></A> to retrieve elements.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#push(java.lang.Object)">push</A></CODE> in class <CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html" title="class in net.jxta.impl.util">UnbiasedQueue</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - object to push<DT><B>Returns:</B><DD>true if the obj was pushed, otherwise false.</DL></DD></DL><HR><A NAME="pushBack(java.lang.Object)"><!-- --></A><H3>pushBack</H3><PRE>public boolean <B>pushBack</B>(java.lang.Object obj)</PRE><DL><DD>Attempt to push an object back at the head the queue. If the queue is full then the object will not be pushed. This method does not use any synchronization and should not be used if other threads are using <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pop(long)"><CODE>UnbiasedQueue.pop(long)</CODE></A> to retrieve elements.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pushBack(java.lang.Object)">pushBack</A></CODE> in class <CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html" title="class in net.jxta.impl.util">UnbiasedQueue</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - object to push<DT><B>Returns:</B><DD>true if the obj was pushed, otherwise false.</DL></DD></DL><HR><A NAME="push(java.lang.Object, long)"><!-- --></A><H3>push</H3><PRE>public boolean <B>push</B>(java.lang.Object obj, long timeout) throws java.lang.InterruptedException</PRE><DL><DD>Push an object onto the queue. If the queue is full then the push will wait for up to "timeout" milliseconds to push the object. At the end of "timeout" milliseconds, the push will either return false or remove the oldest item from the queue and insert "obj". This behaviour is contolled by the constructor parameter "dropOldest".<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#push(java.lang.Object, long)">push</A></CODE> in class <CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html" title="class in net.jxta.impl.util">UnbiasedQueue</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - Object to be pushed onto the queue<DD><CODE>timeout</CODE> - Time in milliseconds to try to insert the item into a full queue. Per Java standards, a timeout of "0" (zero) will wait indefinitly. Negative values force no wait period at all.<DT><B>Returns:</B><DD>true if the object was intersted into the queue, otherwise false.<DT><B>Throws:</B><DD><CODE>java.lang.InterruptedException</CODE> - if the operation is interrupted before the timeout interval is completed.</DL></DD></DL><HR><A NAME="pushBack(java.lang.Object, long)"><!-- --></A><H3>pushBack</H3><PRE>public boolean <B>pushBack</B>(java.lang.Object obj, long timeout) throws java.lang.InterruptedException</PRE><DL><DD>Push an object back at the head of the queue. If the queue is full then the push will wait for up to "timeout" milliseconds to push the object. At the end of "timeout" milliseconds, the push will either return false or remove the oldest item from the queue and insert "obj". This behaviour is contolled by the constructor parameter "dropOldest". <p/>Timeout control is accomplished via synchronization and <CODE>Object.wait(long)</CODE>. <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pushBack(java.lang.Object, long)"><CODE>UnbiasedQueue.pushBack(Object,long)</CODE></A> should only be used in conjunction with <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#push(java.lang.Object, long)"><CODE>UnbiasedQueue.push(Object,long)</CODE></A> and <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pop(long)"><CODE>UnbiasedQueue.pop(long)</CODE></A><P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pushBack(java.lang.Object, long)">pushBack</A></CODE> in class <CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html" title="class in net.jxta.impl.util">UnbiasedQueue</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - Object to be pushed onto the queue<DD><CODE>timeout</CODE> - Time in milliseconds to try to insert the item into a full queue. Per Java standards, a timeout of "0" (zero) will wait indefinitly. Negative values force no wait period at all.<DT><B>Returns:</B><DD><tt>true</tt> if the object was intersted into the queue, otherwise <tt>false</tt>.<DT><B>Throws:</B><DD><CODE>java.lang.InterruptedException</CODE> - if the operation is interrupted before the timeout interval is completed.</DL></DD></DL><HR><A NAME="peek()"><!-- --></A><H3>peek</H3><PRE>public java.lang.Object <B>peek</B>()</PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -