I'm still getting connections don't returning to the pool. Just in one (only
one) method in my 5000 lines of code for the session bean...
An I have same structure for all methods that make database access. I think
that have some type of checking to determine if connection should be kept
inside transaction that are not detecting the method has ended...

I have one main method (load) in my session, that call several methods (like
getAll described before - in the end of this e-mail). I'm trying to
understand why connection open/close are not working. The load structure is
like:

public void load( String code ) {
  List l1 = getAll1();
  List l2 = getAll2();
  List l3 = getAll3();
  List l4 = getAll4();
}

In getAll1() I have "gave out" and "returned object";
In getAll2() I have "gave out" and "returned object";
In getAll3() I have "gave out";
In getAll4() I have "created new connection; gave out new connection;
returned connection";

Why just only getAll3 method connection not returning the object to the
pool? And, if the pool think that he have to share connection inside
transaction, why I'm having not only a "gave out" when getAll1 is called,
and a "returned object" when getAll4 is ended?

Maybe this a JConnect bug? How JBoss determine that transaction has ended
and should return to the pool?


Thanks a lot by your patience,

Edson Richter

----- Original Message -----
From: "Edson Carlos Ericksson Richter" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, November 21, 2001 12:56 PM
Subject: Re: [JBoss-user] JDBC Pool - Getting in trouble


> Thanks for prompt response. Well, the problem is related to code inside
this
> messate (first message that I have sent, and repeated at the end of this
> mail). As you can see, I have a "_close( connection, statement,
resultSet)"
> that does not close no connection. So, the connection still allocated for
> that method forever. So, if I have 10 calls to this method, jboss freeze
> waiting for a connection be released... Thats all.
>
> Of course, if I configure JBoss to collect idle connections from time to
> time (let's say: 3 seconds), I get connection back to the pool. But what
> make me crazy is the fact that, besides I call close for that connection,
> they are not release to the pool.
>
> Thanks again
>
>
> Edson Richter
>
> ----- Original Message -----
> From: "David Jencks" <[EMAIL PROTECTED]>
> To: "Edson Carlos Ericksson Richter" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, November 21, 2001 11:53 AM
> Subject: Re: [JBoss-user] JDBC Pool - Getting in trouble
>
>
> > Well, you haven't told us what the actual problem you are having is.  I
> > doubt it is that jboss logging isn't working properly;-)  Have you
> verified
> > that there are different numbers of takes and puts for the pool? (not
that
> > every close is followed by a put).  Does this occur only under high
> > continuous load?  If so I recommend you try the ConnectionFactoryLoader
> > type setup from cvs.
> >
> > david jencks
> >
> > On 2001.11.21 08:22:41 -0500 Edson Carlos Ericksson Richter wrote:
> > > So I'm getting a crazy operational failure due to connection does not
> > > returning to spool...
> > >
> > > I figured out that setting appropriate values in the JCML I can get
> > > connection to the pool again... But imagine a high demand use (lets
say,
> > > 200
> > > users)... What will be happenning? My app is not a "book sales", where
> > > the
> > > user stops, think, then buy... It's a full time user intensive with
high
> > > volume HTML generation...
> > >
> > > Why calling close does not really close connection? Even when we
already
> > > have
> > > executed all methods that go inside transactions (and even if I
> configure
> > > the
> > > methods to not use transactions)...
> > >
> > >
> > > Edson Richter
> > >
> > >
> > > ----- Original Message -----
> > > From: "David Jencks" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Tuesday, November 20, 2001 11:04 AM
> > > Subject: Re: [JBoss-user] JDBC Pool - Getting in trouble
> > >
> > >
> > > > JBoss is logging every message.
> > > >
> > > > I am arguing by analogy from the ConnectionManager treatment of this
> > > > problem, I think it works the same way for XADataSourceLoader etc.
> > > >
> > > > Unless you are using the xa features of an xa driver, a connection
> will
> > > be
> > > > taken from the pool for the first connection needed in a
transaction,
> > > and
> > > > it will be kept around until the transaction has committed, then it
> > > will
> > > be
> > > > returned to the pool.  So if there are 2 chunks of work in a
> > > transaction,
> > > > you will only see one checkout and one checkin logged.
> > > >
> > > > btw I made a mistake, you are correct, in [x/y/z]
> > > > x = number in use (NOT number free)
> > > > y = number existing
> > > > z = max
> > > >
> > > > david jencks
> > > >
> > > > On 2001.11.20 08:16:42 -0500 Edson Carlos Ericksson Richter wrote:
> > > > > With logging enabled, for every connection I open I should get
"gave
> > > out
> > > > > pooled object". For every close I should get "returned object".
> > > > > But, as I can see, JBoss does not log every message. Appear that
he
> > > does
> > > > > only when he get time to do. I have several
datasource.getConnection
> > > that
> > > > > does not give me "gave out" and several close that does not give
me
> > > > > "returned object". How can I force every message for debbuging
poll?
> > > > >
> > > > > I've tryied to debug JBoss, but this is so hard to me...
> > > > >
> > > > >
> > > > > Thanks.
> > > > >
> > > > > Edson Richter
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "Edson Carlos Ericksson Richter"
<[EMAIL PROTECTED]>
> > > > > To: <[EMAIL PROTECTED]>
> > > > > Sent: Tuesday, November 20, 2001 8:09 AM
> > > > > Subject: Re: [JBoss-user] JDBC Pool - Getting in trouble
> > > > >
> > > > >
> > > > > > I've configured this method for not using transaction, but
nothing
> > > > > > happens... Connection still getting locked.
> > > > > > More info: I'm using JBoss 2.4.3, Tomcat 4.01, JConnect 5.5 and
> > > Sybase
> > > > > > 11.9.2 (NT, without fixes).
> > > > > > Configuring idletimeout does not release connections (so appear
> > > that
> > > > > locked
> > > > > > connections are not idle - and they are - I have closed them)
...
> > > > > >
> > > > > > If anyone has experienced this kind of trouble, any tips will be
> > > > > welcome.
> > > > > >
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > >
> > > > > > Edson Richter
> > > > > >
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > From: "Edson Carlos Ericksson Richter"
> <[EMAIL PROTECTED]>
> > > > > > To: <[EMAIL PROTECTED]>
> > > > > > Sent: Monday, November 19, 2001 6:38 PM
> > > > > > Subject: Re: [JBoss-user] JDBC Pool - Getting in trouble
> > > > > >
> > > > > >
> > > > > > > I'm getting in trouble with JDBC Pool.
> > > > > > > After all use of a connection, I close resultSet, I close the
> > > > > statement
> > > > > > and
> > > > > > > then close Connection.
> > > > > > > After all closes I get "returned object", except in one case.
If
> > > > > anyone
> > > > > > can
> > > > > > > analyse this code and give some idea, please do:
> > > > > > >

public List getAll() throws RemoteException {
         ArrayList lista = null;
         Connection connection = null;
         Statement statement = null;
         ResultSet resultSet = null;
         MyObject tipo = null;

         try {
             StringBuffer sql = new StringBuffer( "select co_tipo, ds_tipo
from tipo order by co_tipo" );
             connection = this._getConnection( ); // this method returns one
connection from the pool.

             statement = connection.createStatement( );
             resultSet = statement.executeQuery( sql.toString( ) );
             tipo = null;

             lista = new ArrayList( );

             while( resultSet.next( ) ) {
                 try {
                   tipo = new MyObject( );
                   tipo.codigo = resultSet.getInt( 1 );
                   tipo.descricao = resultSet.getString( 2 );
                 } catch( Exception e ) {
                   e.printStackTrace( );
                 }

                 lista.add( tipo );
             }
         } catch( Exception e ) {
             e.printStackTrace();
             lista = null;
         } finally {
             this._close( connection, statement, resultSet ); //this method
closes, in order, ResultSet, Statement and then Connection
         }

         return lista;
     }

     private void _close( Connection connection, Statement statement,
ResultSet resultSet ) {
       if( _DEBUG )
         System.out.println("_close( Connection, Statement, ResultSet )" );

         if( resultSet != null ) {
             try {
                 resultSet.close( );
             } catch( Exception e ) {
               e.printStackTrace( );
             }
         }

         if( statement != null ) {
             try {
                 statement.close( );
             } catch( Exception e ) {
               e.printStackTrace( );
             }
         }

         if( connection != null ) {
             try {
                 connection.close( );
             } catch( Exception e ) {
               e.printStackTrace( );
             }
         }
     }

     private Connection _getConnection( ) {

         DataSource dataSource = null;
         Connection connection = null;

         try {
             javax.naming.Context context = new
javax.naming.InitialContext( );

             try {
                 dataSource = ( DataSource )context.lookup(
"java:/jdbc/myDB" );
             } catch( Exception e2 ) {
                 e2.printStackTrace();
                 throw new EJBException( "Erro buscando o DataSource: " +
e2.toString( ) );
             }

             try {
                 connection = dataSource.getConnection( );
             } catch( Exception e2 ) {
                 e2.printStackTrace();
                 throw new EJBException( "Erro buscando Connection: " +
e2.toString( ) );
             }
         } catch( Exception e1 ) {
             e1.printStackTrace();
             throw new EJBException( "N�o foi poss�vel obter o \"Initial
Context\": " + e1.toString( ) );
         }

         return connection;
     }


> > > > > > > I have several other methods that works exactly same way, but
> > > they
> > > > > closes
> > > > > > > connection when I call _close in finally clause...
> > > > > > > Maybe this a JDBC Pool bug? Setting connection time out in
JCML
> > > > > > > configuration file does not release connection nevermore...
> > > > > > >
> > > > > > > Anyone can give a light?
> > > > > > >
> > > > > > >
> > > > > > > Thanks,
> > > > > > >
> > > > > > >
> > > > > > > Edson Richter
> > > > > > >



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to