7 Replies Latest reply: Jul 4, 2012 7:33 AM by ILya Cyclone RSS

    How to force application module to reconnect?

    ILya Cyclone
      Hello OTN,
      I have some specific code in AppMOduleImpl::afterConnect() method.
      On some condition I need to force AppModule to disconnect and esteblish new connection, executing afterConnect method.

      Could someone suggest a solution?

      Thank you.
      ADF 11.1.2.1

      Edited by: ILya Cyclone on Jan 23, 2012 1:41 AM
        • 1. Re: How to force application module to reconnect?
          Sudipto Desmukh
          Can't you use the ApplicationModuleImpl.reconnect(true) method ?
          AS per http://docs.oracle.com/cd/B14099_19/web.1012/b14022/oracle/jbo/client/remote/ApplicationModuleImpl.html#reconnect_boolean_ -
          "Reconnect the application module to the database, if necessary, using previously supplied database credentials. If the parameter is true, then a database disconnect and reconnect is performed, whatever the current connection state. If false, the connect is only performed if the connection has disappeared."
          • 2. Re: How to force application module to reconnect?
            ILya Cyclone
            Hello,
            I don't know, what this documentation means, but there's no such method available in my class, extending ApplicationModuleImpl.
            • 3. Re: How to force application module to reconnect?
              565975
              You may use
              disconnect
              on the condition and then use
              reconnect
              to re-establish the connection. This disconnection and reconnection affects the performance.

              use the below urls

              http://docs.oracle.com/cd/E17904_01/apirefs.1111/e10653/oracle/jbo/client/remote/ApplicationModuleImpl.html#disconnect(boolean)
              http://docs.oracle.com/cd/E17904_01/apirefs.1111/e10653/oracle/jbo/client/remote/ApplicationModuleImpl.html#reconnect()
              • 4. Re: How to force application module to reconnect?
                Sudipto Desmukh
                Out of the box our AMs extend oracle.jbo.server.ApplicationModuleAMImpl ... but the recconect(boolean) method is available in oracle.jbo.client.remote.ApplicationModuleImpl
                • 5. Re: How to force application module to reconnect?
                  ILya Cyclone
                  So it would be
                  ((oracle.jbo.client.remote.ApplicationModuleImpl)this).reconect();
                  in my custom app module java class or smth?
                  • 6. Re: How to force application module to reconnect?
                    ILya Cyclone
                    Still looking for reconnect method.
                    We need it to provide database proxying which is called in AppModule:prepareSession method. A user enters his password which is used in prepareSession method.
                    The problem is after inicial connection establishing this method is not called anymore - even though the password was wrong. We need to force AppModule to disconnect.

                    Now we are investigating "Disconnect Application Module Upon Release" app module property (Application Module configuration - Pooling and Scalability tab).
                    With this property unchecked app module really disconnects and calling prepareSession next time app module is used, but disconnect happens every request even though "Application Module Pooling" is checked.
                    Is it expacted behavior? "Upon Rlease" means "after serving every request"?

                    Event though this method allows us to disconnect app module when there was a wrong password and establish connection with another password, I believe it leads to huge performance issues as every app module is establishing new connection every request. Correct?

                    Any help would be appreciated.
                    Thank you.

                    ADF11R2

                    Edited by: ILya Cyclone on Jul 4, 2012 1:48 PM
                    • 7. Re: How to force application module to reconnect?
                      ILya Cyclone
                      Ok. Seems like this.getTransaction().disconnect(); fits me fine.