1 Reply Latest reply: Jul 18, 2013 2:27 PM by Bogdan Coman-Oracle RSS

    Is it possible to force closing of all database handles in the process?

    kbranko

      Hi,

      I wonder if there is a way to force closing of all database handles in the process? Basically, I want to do removeDatabase in main thread without need to track whether other threads have this database open.

      Thanks,

      KB

        • 1. Re: Is it possible to force closing of all database handles in the process?
          Bogdan Coman-Oracle

          Hi,

           

          What operations can take place on the databases in the other threads when you try to remove them from the main thread? Can there be cursors open on those databases or transactions that include operations on the databases?

           

          Generally this is a sure recipe for memory leaks. The application should discard all references to the closed handle. While BDB makes an effort to discard references from closed objects to the allocated memory for an environment, this behavior is not guaranteed. The safe course of action for an application is to discard all references to closed BDB objects. If you are going to share handles for database objects across threads, you should architect your application such that there is no possibility of a thread closing a handle when another thread is using that handle.

           

          From BDB's point of view it doesn't matter from which thread you are closing the database handle (main or not), but only a single thread may do it.

           

          Thanks,

          Bogdan