📄 objectpool.html
字号:
<DD>Obtain an instance from my pool. By contract, clients MUST return the borrowed instance using <A HREF="../../../../org/apache/commons/pool/ObjectPool.html#returnObject(java.lang.Object)"><CODE>returnObject</CODE></A> or a related method as defined in an implementation or sub-interface. <p> The behaviour of this method when the pool has been exhausted is not specified (although it may be specified by implementations).<P><DD><DL><DT><B>Returns:</B><DD>an instance from my pool.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A></CODE></DL></DD></DL><HR><A NAME="returnObject(java.lang.Object)"><!-- --></A><H3>returnObject</H3><PRE>void <B>returnObject</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> obj) throws <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A></PRE><DL><DD>Return an instance to my pool. By contract, <i>obj</i> MUST have been obtained using <A HREF="../../../../org/apache/commons/pool/ObjectPool.html#borrowObject()"><CODE>borrowObject</CODE></A> or a related method as defined in an implementation or sub-interface.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - a <A HREF="../../../../org/apache/commons/pool/ObjectPool.html#borrowObject()"><CODE>borrowed</CODE></A> instance to be returned.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A></CODE></DL></DD></DL><HR><A NAME="invalidateObject(java.lang.Object)"><!-- --></A><H3>invalidateObject</H3><PRE>void <B>invalidateObject</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> obj) throws <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A></PRE><DL><DD>Invalidates an object from the pool By contract, <i>obj</i> MUST have been obtained using <A HREF="../../../../org/apache/commons/pool/ObjectPool.html#borrowObject()"><CODE>borrowObject</CODE></A> or a related method as defined in an implementation or sub-interface. <p> This method should be used when an object that has been borrowed is determined (due to an exception or other problem) to be invalid. If the connection should be validated before or after borrowing, then the <A HREF="../../../../org/apache/commons/pool/PoolableObjectFactory.html#validateObject(java.lang.Object)"><CODE>PoolableObjectFactory.validateObject(java.lang.Object)</CODE></A> method should be used instead.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - a <A HREF="../../../../org/apache/commons/pool/ObjectPool.html#borrowObject()"><CODE>borrowed</CODE></A> instance to be returned.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A></CODE></DL></DD></DL><HR><A NAME="addObject()"><!-- --></A><H3>addObject</H3><PRE>void <B>addObject</B>() throws <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A></PRE><DL><DD>Create an object using my <A HREF="../../../../org/apache/commons/pool/ObjectPool.html#setFactory(org.apache.commons.pool.PoolableObjectFactory)"><CODE>factory</CODE></A> or other implementation dependent mechanism, and place it into the pool. addObject() is useful for "pre-loading" a pool with idle objects. (Optional operation).<P><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A></CODE></DL></DD></DL><HR><A NAME="getNumIdle()"><!-- --></A><H3>getNumIdle</H3><PRE>int <B>getNumIdle</B>() throws <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang">UnsupportedOperationException</A></PRE><DL><DD>Return the number of instances currently idle in my pool (optional operation). This may be considered an approximation of the number of objects that can be <A HREF="../../../../org/apache/commons/pool/ObjectPool.html#borrowObject()"><CODE>borrowed</CODE></A> without creating any new instances.<P><DD><DL><DT><B>Returns:</B><DD>the number of instances currently idle in my pool<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang">UnsupportedOperationException</A></CODE> - if this implementation does not support the operation</DL></DD></DL><HR><A NAME="getNumActive()"><!-- --></A><H3>getNumActive</H3><PRE>int <B>getNumActive</B>() throws <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang">UnsupportedOperationException</A></PRE><DL><DD>Return the number of instances currently borrowed from my pool (optional operation).<P><DD><DL><DT><B>Returns:</B><DD>the number of instances currently borrowed in my pool<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang">UnsupportedOperationException</A></CODE> - if this implementation does not support the operation</DL></DD></DL><HR><A NAME="clear()"><!-- --></A><H3>clear</H3><PRE>void <B>clear</B>() throws <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang">UnsupportedOperationException</A></PRE><DL><DD>Clears any objects sitting idle in the pool, releasing any associated resources (optional operation).<P><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang">UnsupportedOperationException</A></CODE> - if this implementation does not support the operation<DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A></CODE></DL></DD></DL><HR><A NAME="close()"><!-- --></A><H3>close</H3><PRE>void <B>close</B>() throws <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A></PRE><DL><DD>Close this pool, and free any resources associated with it.<P><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A></CODE></DL></DD></DL><HR><A NAME="setFactory(org.apache.commons.pool.PoolableObjectFactory)"><!-- --></A><H3>setFactory</H3><PRE>void <B>setFactory</B>(<A HREF="../../../../org/apache/commons/pool/PoolableObjectFactory.html" title="interface in org.apache.commons.pool">PoolableObjectFactory</A> factory) throws <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang">UnsupportedOperationException</A></PRE><DL><DD>Sets the <A HREF="../../../../org/apache/commons/pool/PoolableObjectFactory.html" title="interface in org.apache.commons.pool"><CODE>factory</CODE></A> I use to create new instances (optional operation).<P><DD><DL><DT><B>Parameters:</B><DD><CODE>factory</CODE> - the <A HREF="../../../../org/apache/commons/pool/PoolableObjectFactory.html" title="interface in org.apache.commons.pool"><CODE>PoolableObjectFactory</CODE></A> I use to create new instances.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - when the factory cannot be set at this time<DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang">UnsupportedOperationException</A></CODE> - if this implementation does not support the operation</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> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ObjectPool.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../org/apache/commons/pool/KeyedPoolableObjectFactory.html" title="interface in org.apache.commons.pool"><B>PREV CLASS</B></A> <A HREF="../../../../org/apache/commons/pool/ObjectPoolFactory.html" title="interface in org.apache.commons.pool"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/apache/commons/pool/ObjectPool.html" target="_top"><B>FRAMES</B></A> <A HREF="ObjectPool.html" target="_top"><B>NO FRAMES</B></A> <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: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR>Copyright © 2001-2006 The Apache Software Foundation. All Rights Reserved.</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -