Please correct me if I'm wrong, but wouldn't it be safer to have
the broker.close(); method in a finally block? Something like:
PersistenceBroker broker = null;
try
{
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
// use the broker
}
catch (PersistenceBrokerException ex)
{
// handle exception
}
catch (PBFactoryException ex)
{
// handle exception
}
finally
{
if ( broker != null )
{
try
{
broker.close();
} catch ( Exception ignored ) {}
}
}
Shannon Hardt
-----Original Message-----
From: Phase Web and Multimedia [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 09, 2002 4:32 AM
To: OJB Users List
Subject: RE: PersistensBroker in servlets
I've been using it in a servlet environment for some time. You need to
retrieve a PesistenceBroker from the poool that exists already and use it do
your operations and close it. Just make sure you close it when you are done.
Example:
try{
PersistenceBroker broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
broker.close();
} catch (PersistenceBrokerException ex) {
logger.error(ex.getMessage(), ex.fillInStackTrace());
} catch (PBFactoryException ex) {
logger.error(ex.getMessage(), ex.fillInStackTrace());
}
Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
[EMAIL PROTECTED]
http://www.phase.ws
> -----Original Message-----
> From: Roland Carlsson [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 09, 2002 3:05 AM
> To: OJB Users List
> Subject: PersistensBroker in servlets
>
>
> Hi!
> How do one use OJB in a servlets? The example I finds is only an
> application and I doesn't find any information concurrency in
> OJB. Is the PersistensBroker synchronized properly to be used
> strait ahead or do I have to build a broker-pool
>
> I'm sorry if I missed anything in the documentation
>
> Thanks in advance
> Roland Carlsson
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>