<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    What happens, once we call close on a connection retrieved from WrapperConnection
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/ayushgupta">Ayush Gupta</a> in <i>Datasource Configuration</i> - <a href="https://community.jboss.org/message/714664#714664">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I have been using xa-datasource to have a connection pool for underlying oracle 10g database. I have created a pool of min size : 20 and max size : 40. I have a scenario where 20 threads are active, and each threads takes connection from the pool, completes its DB operation (i.e. saves approx 4000 records to DB). Once it completes the execution, it closes the connection which ideally should go back to the connection pool. The execution thread repeats&#160; it execution by taking a connection from pool and closes at the end on each execution cycle.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;xa-datasource&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;jndi-name&gt;</span>appstatetxds<span class="jive-xml-tag">&lt;/jndi-name&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;use-java-context&gt;</span>false<span class="jive-xml-tag">&lt;/use-java-context&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;track-connection-by-tx&gt;</span><span class="jive-xml-tag">&lt;/track-connection-by-tx&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;isSameRM-override-value&gt;</span>false<span class="jive-xml-tag">&lt;/isSameRM-override-value&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;xa-datasource-class&gt;</span>oracle.jdbc.xa.client.OracleXADataSource<span class="jive-xml-tag">&lt;/xa-datasource-class&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;xa-datasource-property name="URL"&gt;</span>jdbc:oracle:thin:@smm_db_host:1521/ALSMM<span class="jive-xml-tag">&lt;/xa-datasource-property&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;xa-datasource-property name="User"&gt;</span>EPB_APP_CONF<span class="jive-xml-tag">&lt;/xa-datasource-property&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;xa-datasource-property name="Password"&gt;</span>abc123<span class="jive-xml-tag">&lt;/xa-datasource-property&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;exception-sorter-class-name&gt;</span>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter<span class="jive-xml-tag">&lt;/exception-sorter-class-name&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;no-tx-separate-pools&gt;</span><span class="jive-xml-tag">&lt;/no-tx-separate-pools&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-comment">&lt;!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool --&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;valid-connection-checker-class-name&gt;</span>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker<span class="jive-xml-tag">&lt;/valid-connection-checker-class-name&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!--pooling parameters--&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;min-pool-size&gt;</span>20<span class="jive-xml-tag">&lt;/min-pool-size&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;max-pool-size&gt;</span>40<span class="jive-xml-tag">&lt;/max-pool-size&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;blocking-timeout-millis&gt;</span>15000<span class="jive-xml-tag">&lt;/blocking-timeout-millis&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;idle-timeout-minutes&gt;</span>50000<span class="jive-xml-tag">&lt;/idle-timeout-minutes&gt;</span>


&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;metadata&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;type-mapping&gt;</span>Oracle10g<span class="jive-xml-tag">&lt;/type-mapping&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/metadata&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/xa-datasource&gt;</span>


</code></pre><p>Now as connection is closed, it should go back to the pool immediately, but what I have been observing from the admin console, that max connection count goes upto 28. It is sure that no other process is running into the system apart from these 20 threads. Each thread retrieves the connection from pool and closes it.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I just want to know, what could be the reason for going a max count upto 28, which should ideally be 20.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Does close method invocation, just returns the handler, and in back-ground it actually takes time to synchronize the data with uderlying DB. I just want to restrict that the haldler should be returned only once the connection actually is returned back to pool.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/714664#714664">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Datasource Configuration at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>