⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unbiasedqueue.html

📁 jxta的api库
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<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></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></DL></DD></DL><HR><A NAME="push(java.lang.Object)"><!-- --></A><H3>push</H3><PRE>public boolean <B>push</B>(java.lang.Object&nbsp;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>pop(long)</CODE></A> to  retrieve elements.<P><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&nbsp;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>pop(long)</CODE></A> to retrieve elements.<P><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&nbsp;obj,                    long&nbsp;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>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&nbsp;obj,                        long&nbsp;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>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>push(Object,long)</CODE></A> and  <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pop(long)"><CODE>pop(long)</CODE></A><P><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><DL><DD>Return the next Object from the queue without removing it.<P><DD><DL><DT><B>Returns:</B><DD>Object, null if the queue is empty.</DL></DD></DL><HR><A NAME="pop()"><!-- --></A><H3>pop</H3><PRE>public java.lang.Object <B>pop</B>()</PRE><DL><DD>Remove and return the next Object from the queue.<P><DD><DL><DT><B>Returns:</B><DD>Object, null if the queue is empty.</DL></DD></DL><HR><A NAME="pop(long)"><!-- --></A><H3>pop</H3><PRE>public java.lang.Object <B>pop</B>(long&nbsp;timeout)                     throws java.lang.InterruptedException</PRE><DL><DD>Gets a Object from the queue. If no Object is immediately available, then wait the specified amount of time for an Object to be inserted.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>timeout</CODE> - Amount of time to wait in milliseconds for an object to be available. Per Java convention, a timeout of zero (0) means wait an infinite amount of time. Negative values mean do not wait at all.<DT><B>Returns:</B><DD>The next object in the queue.<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="popMulti(int)"><!-- --></A><H3>popMulti</H3><PRE>public java.lang.Object[] <B>popMulti</B>(int&nbsp;maxObjs)</PRE><DL><DD>Returns an array of objects, possibly empty, from the queue.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>maxObjs</CODE> - the maximum number of items to return.<DT><B>Returns:</B><DD>an array of objects, possibly empty containing the returned  queue elements.</DL></DD></DL><HR><A NAME="getMaxQueueSize()"><!-- --></A><H3>getMaxQueueSize</H3><PRE>public int <B>getMaxQueueSize</B>()</PRE><DL><DD>How many objects will fit in this queue<P><DD><DL><DT><B>Returns:</B><DD>int indicating how many objects will fit in the queue.</DL></DD></DL><HR><A NAME="setMaxQueueSize(int)"><!-- --></A><H3>setMaxQueueSize</H3><PRE>public void <B>setMaxQueueSize</B>(int&nbsp;maxObjs)</PRE><DL><DD>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.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>maxObjs</CODE> - The number of objects which the queue must be able to  store.</DL></DD></DL><HR><A NAME="getCurrentInQueue()"><!-- --></A><H3>getCurrentInQueue</H3><PRE>public int <B>getCurrentInQueue</B>()</PRE><DL><DD>Return the number of elements currently in the queue. This method is  useful for statistical sampling, but should not be used to determine  program logic due to the multi-threaded behaviour of these queues.  <p/>You should use the return values and timeout behaviour of the  <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#push(java.lang.Object)"><CODE>push(Object)</CODE></A> and <A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pop(long)"><CODE>pop(long)</CODE></A> methods to regulate how you  use the queue.<P><DD><DL><DT><B>Returns:</B><DD>the number of elements currently in the queue. Be warned that  even two sequential calls to this method may return different answers  due to activity on other threads.</DL></DD></DL><HR><A NAME="getNumEnqueued()"><!-- --></A><H3>getNumEnqueued</H3><PRE>public long <B>getNumEnqueued</B>()</PRE><DL><DD>Return the total number of objects which have been enqueued on to this  queue during its existance.<P><DD><DL><DT><B>Returns:</B><DD>how many objects have been queued.</DL></DD></DL><HR><A NAME="getAvgInQueueAtEnqueue()"><!-- --></A><H3>getAvgInQueueAtEnqueue</H3><PRE>public double <B>getAvgInQueueAtEnqueue</B>()</PRE><DL><DD>Return the average number of elements in the queue at Enqueue time.<P><DD><DL><DT><B>Returns:</B><DD>average number of elements which were in the queue at during all  of the "push" operations which returned a "true" result. Does not  include the item being pushed. If no elements have ever been enqueued  then "NaN" will be returned.</DL></DD></DL><HR><A NAME="getNumDequeued()"><!-- --></A><H3>getNumDequeued</H3><PRE>public long <B>getNumDequeued</B>()</PRE><DL><DD>Return the total number of objects which have been dequeued from this  queue during its existance.<P><DD><DL><DT><B>Returns:</B><DD>how many objects have been queued.</DL></DD></DL><HR><A NAME="getAvgInQueueAtDequeue()"><!-- --></A><H3>getAvgInQueueAtDequeue</H3><PRE>public double <B>getAvgInQueueAtDequeue</B>()</PRE><DL><DD>Return the average number of elements in the queue at dequeue time.<P><DD><DL><DT><B>Returns:</B><DD>average number of elements which were in the queue at during all  of the "pop" operations which returned a non-null result. Includes the item being "pop"ed in the average. If no elements have ever been dequeued  then "NaN" will be returned.</DL></DD></DL><HR><A NAME="getNumDropped()"><!-- --></A><H3>getNumDropped</H3><PRE>public long <B>getNumDropped</B>()</PRE><DL><DD>Return the total number of objects which have been dropped by this queue  during its existance.<P><DD><DL><DT><B>Returns:</B><DD>how many objects have been dropped.</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=3 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/UnbiasedQueue.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>JXTA J2SE</EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../../net/jxta/impl/util/TimeUtils.html" title="class in net.jxta.impl.util"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.SynchronizedQueue.html" title="class in net.jxta.impl.util"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="UnbiasedQueue.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;<A HREF="#nested_class_summary">NESTED</A>&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -