[ 
http://issues.apache.org/jira/browse/IBATIS-198?page=comments#action_12331078 ] 

cailuyu commented on IBATIS-198:
--------------------------------

that is how we changed the method "public DataSource getDataSource()" now:

  public DataSource getDataSource() {
    DataSource ds = null; 
    if( localSqlMapSession.get()!=null ){
      ds = getLocalSqlMapSession().getDataSource();
      getLocalSqlMapSession().close();
    }
    else{
      ds = getLocalSqlMapSession().getDataSource();
    }
    return ds;
  }

> Call "getDataSource()" of SqlMapClientImpl will cause application to hang
> -------------------------------------------------------------------------
>
>          Key: IBATIS-198
>          URL: http://issues.apache.org/jira/browse/IBATIS-198
>      Project: iBatis for Java
>         Type: Bug
>   Components: SQL Maps
>     Versions: 2.0.9b
>  Environment: NT, Orable,JONAS
>     Reporter: cailuyu
>     Priority: Critical

>
> Hi
>   
>   We found a system-hanging problem in our application.
>   In our application, we need the DataSource, so we call  getDataSource() 
> from SqlMapClient interface.
>   The implementation of this methos is:
>   public DataSource getDataSource() {
>     return getLocalSqlMapSession().getDataSource();
>   }
>   
>   This method will try to get a session first, but if it can't find a 
> existent session, it will create a new one. but after that no one will close 
> this session, and then the system will be blocked.
>   So, is there any method can help us to release this session? for now we 
> change this method like this, and everything is ok:
>     public DataSource getDataSource() {
>     DataSource ds = getLocalSqlMapSession().getDataSource();
>     getLocalSqlMapSession().close();
>     return ds;
>     }
>   But I don't think that is a right way, because maybe the session is not a 
> new one, we can't simply close it.
> Thanks,
> Luyu Cai
>   

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to