0 Replies Latest reply on Dec 14, 2012 12:41 AM by hetaoblog Y

    Questions about BaseConnectionEventListener.permit

    hetaoblog Y Newbie

      I’m reading Jboss source code 4.0.4, However, I’ve a question about below field

      1. BaseConnectionEventListener.permit

      to my understanding, this field is set only when before returning one connection in InternalManagedConnectionPool.getConnection() method, (twice called there, at line 247 and 193)

      1. cl.grantPermit(true);


      while the hasPermit() method is only called at line 283 and 337 in the method of returnConnection,

      so, it looks to me it's always true when checked,  so what's the purpose of first set it to true and then to check whether it's true?

      is there a possibility that it's not true when calling hasPermit()?


      meanwhile, is it possible that somehow from line 337-342, the permits.release() are actually not called due to some kind of error?  ideally the cl instance will not be hold by multiple threads.... not sure if it can be an issue. if it's somehow possible, then the cl instance, which i think is 'BaseConnectionEventListener.permit' is not thread safe??

               if (cl.hasPermit())


                  // release semaphore





      2. one actual problem,

      we've an app running in many machines, they connect to oracle 11g database, when our db get some issues and restarted,  some app machines will keep getting below exception for about 40 minutes after db recover; so finally we restarted the apps... any ideas about why?

      'No ManagedConnections available within configured blocking timeout..'


      1. a. below are main config parameters, we're using <local-tx-datasource>, we checked the ORA exceptions in the log and find all the ora errors are supposed to be fatal; so it is supposed to call doDestroy() finally...