Hi,
I found the problem but not the solution. The problem is that in
some circumstances, in one thread two database opens happen due to the
sequence of operations. Then OJB closes, the open database and opens
another one. Although two subsequent closes are called on the database,
there seems to be a leak of a broker when this happens. Is there any way
on OJB 0.9.5 to know weathered a database is already opened for that
thread so that this leak can be prevented.
Thanks
Jose
_____________________________________________________________________
Jose Thomas
IBM Global Services India Pvt. Ltd.
2nd Floor, Prestige Towers,
99, Residency Road,
Bangalore, India PIN 560025
Phone Board :91-80-2073333, 91-80-2079999
Extension : 2264
FAX :91-80-2079212
Internet: [EMAIL PROTECTED]
----- Forwarded by Jose Thomas/India/IBM on 11/07/2002 04:33 PM -----
Jose Thomas
11/07/2002 04:06 PM
To: "OJB Users List" <[EMAIL PROTECTED]>
cc:
From: Jose Thomas/India/IBM@IBMIN
Subject: Re: AW: Problem with open data base in a servlet environment
Thomas,
Thanks for the response. That didn't solve the problem but I
circumvented the problem in a different way. But the root problem that
made me confront this still exists. The problem is as follows.
As explained earlier the environment is OJB Version 0.9.5 with odmg apis.
This is running in WSAD/WAS 4.0 with DB2 7.2
I have a instance level ODMG Instance and database variables which are
initialized at instance level using OJB.getInstance() and
odmg.newDatabase()
Again per thread a database.open( repositoryFile,
Database.OPEN_READ_WRITE ) is done and a corresponding database.close is
done for this using a clean up function in the process layer. But we find
the following message in the log file
Already created persistence broker instances: 1 intermittently and the
instance number goes up. Finally at some point of time the application
blocks trying to get a new broker instance.
We have ensured that here is a Database.close call for every Database.open
call. In the code we use the broker API using the following code and for
list operations
tx = context.getOdmg().currentTransaction();
PersistenceBroker broker = ((HasBroker) tx).getBroker();
Here alone we are not releasing the broker. Should we release the broker
in this case also or will odmg take care of releasing the broker.
I looked through the Database.open code of OJB and found that there is a
broker.close call in the finally block of that code.
I couldn't find any place in our code where there could be a broker leak.
Would you be able to throw some light on this.
Thanks
Jose
Mahler Thomas <[EMAIL PROTECTED]>
11/06/2002 07:38 PM
Please respond to "OJB Users List"
To: "'OJB Users List'" <[EMAIL PROTECTED]>
cc:
Subject: AW: Problem with open data base in a servlet environment
Maybe this is a synchronization problem?
Try to use a synchronized block (or method) for the critical section
(db.open()).
cheers,
Thomas
> -----Urspr�ngliche Nachricht-----
> Von: Jose Thomas [mailto:joset@;in.ibm.com]
> Gesendet: Mittwoch, 6. November 2002 15:02
> An: [EMAIL PROTECTED]
> Betreff: Problem with open data base in a servlet environment
>
>
> Hi,
> I am using odmg api with ojb version 0.9.5 in our project
>
> I have a base PersistanceContext class which has static
> Implementation and Database instances.
> The odmg instace is initialized by the OJB.getInstance() and
> the database is opened using
> odmg.newDatabase at the
> intialization.
>
> Then in the begin transaction method beofre each transaction
> is created
> and started, a database.open with the repository file name is done.
> The exception generated is caught and ignored in the case of
> a Database
> already open exception.
> Then the transaction is created and begun using the following
> two lines
> tx = odmg.newTransaction() ;
> tx.begin() ;
>
> What happens is that after a few invocations I get the
> following exception
> [11/6/02 19:09:10:898 GMT+05:30] 39850c47 SystemOut U
> (EMBusiness
> 224 ) Error Opening Database : ignoring - Database is
> already open
>
> [11/6/02 19:09:10:898 GMT+05:30] 39850c47 SystemOut U
> [org.apache.ojb.odmg.TransactionImpl] WARN:
> [11/6/02 19:09:10:898 GMT+05:30] 39850c47 SystemOut U
> TransactionImpl
> created with null DatabaseImpl.
> [11/6/02 19:09:11:108 GMT+05:30] 39850c47 SystemOut U
> (EMBusiness
> 224 ) Error while beggining transaction null
> java.lang.NullPointerException
>
> The problem is that just before the warning and exception
> caused due to
> the null databse, I get the database already open exception which is
> caught and ignored, when trying to open the database. This
> database open
> statement is the statement just before the new and begin transaction
> statements that causes the exception. I just cant understand
> how these two
> can happen together. Can anyone tell me what I am doing wrong.
>
> Thanks in advance.
>
> Regards Jose
>
--
To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>