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

📄 producerbiasedqueue.html

📁 jxta的api库
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="ProducerBiasedQueue()"><!-- --></A><H3>ProducerBiasedQueue</H3><PRE>public <B>ProducerBiasedQueue</B>()</PRE><DL><DD>Default constructor. 100 element LIFO queue which drops oldest element when full.<P></DL><HR><A NAME="ProducerBiasedQueue(int, boolean)"><!-- --></A><H3>ProducerBiasedQueue</H3><PRE>public <B>ProducerBiasedQueue</B>(int&nbsp;size,                           boolean&nbsp;dropOldest)</PRE><DL><DD>Full featured constructor for creating a new ConsumerBiasedQueue.<P><DT><B>Parameters:</B><DD><CODE>size</CODE> - Queue will be not grow larger than this size. Use    Integer.MAX_VALUE for "unbounded" queue size.<DD><CODE>dropOldest</CODE> - Controls behaviour of element insertion when the queue is full. If "true" and the queue is full upon a push operation then the oldest element will be dropped to be replaced with the element currently being pushed. If "false" then then newest item will be dropped.</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="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&nbsp;obj)</PRE><DL><DD><B>Description copied from class: <CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html" title="class in net.jxta.impl.util">UnbiasedQueue</A></CODE></B></DD><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="pop()"><!-- --></A><H3>pop</H3><PRE>public java.lang.Object <B>pop</B>()</PRE><DL><DD>Return next obj in the queue if there is one.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pop()">pop</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>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. Per Java convention, a timeout of zero (0) means wait an infinite amount of time. Negative values mean do not wait at all.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#pop(long)">pop</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>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>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#popMulti(int)">popMulti</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>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="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>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#setMaxQueueSize(int)">setMaxQueueSize</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>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. You  should use the return values and timeout behaviour of the push() and pop() methods to regulate how you use the queue.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#getCurrentInQueue()">getCurrentInQueue</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>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="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>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#getAvgInQueueAtEnqueue()">getAvgInQueueAtEnqueue</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>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="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>Overrides:</B><DD><CODE><A HREF="../../../../net/jxta/impl/util/UnbiasedQueue.html#getAvgInQueueAtDequeue()">getAvgInQueueAtDequeue</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>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><!-- ========= 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/ProducerBiasedQueue.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/ModuleManager.html" title="class in net.jxta.impl.util"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../../net/jxta/impl/util/ResourceDispatcher.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="ProducerBiasedQueue.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_classes_inherited_from_class_net.jxta.impl.util.UnbiasedQueue">NESTED</A>&nbsp;|&nbsp;<A HREF="#fields_inherited_from_class_net.jxta.impl.util.UnbiasedQueue">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;FIELD&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 + -