Mark,
Could you log this in JIRA where it can be appropriately tracked?
Thanks,
Clinton
On Thu, 3 Feb 2005 12:50:57 -0600, Mark Nabours
<[EMAIL PROTECTED]> wrote:
>
>
> Hello,
>
> I have a rather serious problem to which we need a quick resolution.
>
> In brief, the increment method on the Throttle class is being called for
> sessions after executing SqlMapClient.setUserConnection() but the
> corresponding decrement method is never being called. After we reach the
> session limit configured in sql-map-config.xml the application hangs hard!
>
> Here are some of the specifics, we are using iBATIS to map data from a
> database to our own set of data objects. However, we are not using iBATIS
> to acquire the database connections; we are externally providing them to
> the iBATIS SqlMapClient through the setUserConnection method, and we clear
> the transaction out by calling setUserConnection and passing null for the
> connection. We have our own connection acquisition code that we use and
> therefore we do not even have a transactionManager element configured
> within sql-map-config.xml -- we would prefer not to have to configure it
> since it requires a data source to be configured and our connection
> acquisition code if highly flexible to use different types of connection
> ion various environments. It's my understanding that it is perfectly
> acceptable to use iBATIS by providing external connections as long as you
> handle all of your transactional requirements (which we do).
>
> I have attached the following test case that illustrates the problem. We
> have configured the maximum session count to 75. Don't read too much into
> our test case code as it acquires a single connection and immediately
> closes it so that we don't leave the connection open when the test case
> freezes. We loop 80 times and we hang after 75 iterations.
>
> /*
> * Created on Feb 3, 2005.
> */
> package com.alliancesys.common.ibatis.testing;
>
> import java.io.Reader;
> import java.sql.Connection;
> import java.sql.SQLException;
>
> import com.alliancesys.common.jdbc.DatabaseConnectionService;
> import com.ibatis.common.resources.Resources;
> import com.ibatis.sqlmap.client.SqlMapClient;
> import com.ibatis.sqlmap.client.SqlMapClientBuilder;
>
> import junit.framework.TestCase;
>
> /**
> * <code>[EMAIL PROTECTED] SqlMapClientSessionTest}</code>
> *
> */
> public class SqlMapClientSessionTest extends TestCase {
>
> private int threadCounter = 0;
>
> public SqlMapClientSessionTest(String arg0) {
> super(arg0);
> }
>
> public static void main(String[] args) {
> junit.textui.TestRunner.run(SqlMapClientSessionTest.class);
> }
>
> private synchronized void writeCount(){
> threadCounter++;
> System.out.println("Thread " + threadCounter + " completed.");
> }
>
> public void testThrottleSessionLock() throws Exception {
>
> final Connection connection =
> DatabaseConnectionService.getNewConnection();
> connection.close();
> Reader reader =
> Resources.getResourceAsReader(
> getClass().getClassLoader(),
> "sql-map-config.xml");
> final SqlMapClient sqlMapClient =
> SqlMapClientBuilder.buildSqlMapClient(reader);
> for (int i = 0; i < 80; i++) {
>
> Runnable runnable = new Runnable() {
> public void run() {
> try {
> SqlMapClient client = sqlMapClient;
> Connection cn = connection;
> client.setUserConnection(cn);
> client.setUserConnection(null);
> writeCount();
> } catch (SQLException e) {
>
> e.printStackTrace();
> }
> }
> };
>
> Thread t = new Thread(runnable);
> t.start();
>
> }
>
> }
>
> }
>
> If you run it, you will notice that if you have max sessions configured to
> 75 it hangs after completion of the 75 thread.
>
> Our sql-map-config.xml file is as follows:
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "
> http://www.ibatis.com/dtd/sql-map-config-2.dtd">
>
> <sqlMapConfig>
>
> <properties
> resource="ibatis.properties" />
>
> <settings
> cacheModelsEnabled="true"
> enhancementEnabled="true"
> maxSessions="75"
> maxTransactions="20"
> maxRequests="140" />
>
> <sqlMap resource="Contact.xml" />
>
> </sqlMapConfig>
>
> We are hoping that it is a configuration problem, but we suspect that the
> decrement method on Throttle needs to be called. Please provide us with a
> solution that would prevent this from happening.
>
> Let me thank you in advance for you help. iBATIS is an great product, but
> this is currently preventing us from moving through QA into production.
>
> Thanks,
> Mark Nabours
>
> (See attached file: sql-map-config.xml)(See attached file:
> SqlMapClientSessionTest.java)
>
> -----------------------------------------
> E-mail Disclaimer: The information contained in this e-mail, and in any
> accompanying documents, may constitute confidential and/or legally
> privileged information. The information is intended only for use by the
> designated recipient. If you are not the intended recipient (or
> responsible for the delivery of the message to the intended recipient),
> you are hereby notified that any dissemination, distribution, copying, or
> other use of, or taking of any action in reliance on this e-mail is
> strictly prohibited. If you have received this email communication in
> error, please notify the sender immediately and delete the message from
> your system.
>
>
>