RE: Reset Cayenne Connection Pool

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Apr 07 2005 - 14:36:06 EDT

  • Next message: Cris Daniluk: "RE: Testing ExpressionFactory for null values"

    Hmm... Cayenne pool can auto-reconnect Oracle connections behind the
    scenes on some (but not all) failures. Could you post the full stack of
    exception?

    Anyway, lets discuss the options... Cayenne stack uses standard
    DataSource interface to obtain connections. Cayenne PoolManager class is a
    default implementation. So you can do *either* of these:

    (1) Get a DataSource from DataNode, cast it to PoolManager, call
    "dispose()", create new PoolManager and set it as a new DataSource of a
    DataNode.

    (2) Subclass PoolManager to implement "reset" instead of "dispose", to
    keep using the same pool.

    (3) Test your app Apache DBCP connection pool, that has more advanced
    "auto-reconnect-on-failure" support. It can be used as a replacement of
    PoolManager. And in 1.2 it is even supported by the Modeler.

    (1) and (2) have a small window when other threads may get errors while
    you are handling an error in any one given thread. So if (3) works, it
    should be a more reliable option...

    Andrus

    > Hello guys,
    >
    > To add to Beth's description - we are getting the following Oracle Error
    >
    > Caused by: java.sql.SQLException: ORA-04068: existing state of packages
    > has been discarded ORA-04061: existing state of package body
    > "MEMBERSHIP.SLS" has been invalidated ORA-04065: not executed, altered
    > or dropped package body "MEMBERSHIP.SLS" ORA-06508: PL/SQL: could not
    > find program unit being called
    > ORA-06512: at line 1
    >
    > through Cayenne after we make changes to a Package and then recompile.
    > We are speculating that the pooled connections are caching (on the
    > Oracle side) an invalid reference to the Package. After we get the
    > failure for a given connection - the call will work if tried again. I
    > believe there is a default behavior with the Oracle JDBC driver that
    > causes it to try to recompile the package/procedure and refresh it's
    > pointer after such a failure. We'd really like to figure out a way to
    > cause the Cayenne connection pool to reset (rebuild). We could then
    > trigger it on demand so we don't have to restart the application servers
    > in order to avoid such an error.
    >
    > Thanks,
    >
    > Brian
    >
    >
    > -----Original Message-----
    > From: Williams, Beth
    > Sent: Thursday, April 07, 2005 9:45 AM
    > To: cayenne-use..bjectstyle.org
    > Subject: Reset Cayenne Connection Pool
    >
    >
    > We have noticed some application errors related to connection pool and
    > changes to stored procedures. We are using several stored procedures
    > through the cayenne ProcedureQuery. What we've found is that when and
    > if a change is made to one of the packages in the database the state of
    > the package is invalidated and the connection pool is discarded. This
    > results in an error for the user. The connection pool is reset and so
    > the next time the user tries it will work.
    >
    > Is there a way to reset the Cayenne connection pool through the API so
    > that we don't have to restart the server? Thanks in advance.
    >
    > Beth Williams
    > Web Applications Developer, NFIB
    > 53 Century Blvd
    > Nashville, TN 37214
    > 615.872.5332
    > beth.william..fib.org



    This archive was generated by hypermail 2.0.0 : Thu Apr 07 2005 - 14:36:08 EDT