You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Stanley Poon <sp...@cisco.com> on 2004/06/03 23:41:47 UTC
Re: Destroy or reset PersistenceBroker
Thomas Mahler <thma32 <at> web.de> writes:
>
> broker.close();
>
> Stanley Poon wrote:
> > In our application, there is a need to destroy or release an instance of the
> > PersistenceBroker. OJB provides
> > PersistenceBrokerFactory.releaseAllInstances(). However, that will destroy
> > all other instances that should not be removed.
> >
> > Is there a way of destroying only one broker? In doing so, will the
> > connections associated with the broker be released?
> >
> > Thanks,
> > Stanley
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe <at> db.apache.org
> > For additional commands, e-mail: ojb-user-help <at> db.apache.org
> >
> >
>
broker.close() only return the object to the pool. Next time around, a call to
get a broker will return the same object. I indeed verified this in the
debugger and see the same object reference returned.
I'm looking for a way to clean up the broker when it is not needed or should be
replaced by a different one. In my case, this is needed so that users can
dynamically change the brokers.
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Destroy or reset PersistenceBroker
Posted by Armin Waibel <ar...@apache.org>.
Hi Stanley,
Stanley Poon wrote:
> Thomas Mahler <thma32 <at> web.de> writes:
>
>
>>broker.close();
>>
>>Stanley Poon wrote:
>>
>>>In our application, there is a need to destroy or release an instance of the
>>>PersistenceBroker. OJB provides
>>>PersistenceBrokerFactory.releaseAllInstances(). However, that will destroy
>>>all other instances that should not be removed.
>>>
>>>Is there a way of destroying only one broker?
sorry no. The PersistenceBroker pooling is hidden. If you want to
control the PB-pool you have to extend the used PersistenceBrokerFactory
implementation specified in OJB.properties
>>> In doing so, will the
>>>connections associated with the broker be released?
>>>
Connections associated with a PB instance will be released automatic on
PB.close()/abortTransaction()/commitTransaction() call. Thus pooled PB
instances are never associated with a connection.
When the connection was released the connection was passed to the
ConnectionFactory implementation. If you use the standard implementation
the connection was returned to the connection pool.
More info here
(beta version of new upcoming docs)
http://www.powaibel.de/ojb/ojb-style/docu/connection.html#ConnectionFactory
regards,
Armin
>>>Thanks,
>>>Stanley
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: ojb-user-unsubscribe <at> db.apache.org
>>>For additional commands, e-mail: ojb-user-help <at> db.apache.org
>>>
>>>
>>
>
>
> broker.close() only return the object to the pool. Next time around, a call to
> get a broker will return the same object. I indeed verified this in the
> debugger and see the same object reference returned.
>
> I'm looking for a way to clean up the broker when it is not needed or should be
> replaced by a different one. In my case, this is needed so that users can
> dynamically change the brokers.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org