It seems to me, that you are confusing the following two concepts: 1.) finally block http://java.sun.com/docs/books/jls/second_edition/html/statements.doc.html#2 36653
2.) finalization of class instances: http://java.sun.com/docs/books/jls/second_edition/html/execution.doc.html#44 748 IMHO you should consider refering to the above links. cheers, Sanyi ----- Original Message ----- From: "Phase Web and Multimedia" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Monday, December 09, 2002 9:31 PM Subject: RE: PersistensBroker in servlets > This would mean that i have to wait on garbage collection to close my > connection. It is a good idea to close your broker in the finally block in > the event that you have an exception. But, I don't like to wait on garbage > collection to close my connections. I perfer to close them explicitly. Also, > I use static methods a lot to perform transactions so i am not dealing with > a garbage collected item as if i would be if i were to instantiate an object > then call the method. > > Brandon Goodin > Phase Web and Multimedia > P (406) 862-2245 > F (406) 862-0354 > [EMAIL PROTECTED] > http://www.phase.ws > > > > -----Original Message----- > > From: Hardt, Shannon [mailto:[EMAIL PROTECTED]] > > Sent: Monday, December 09, 2002 9:32 AM > > To: OJB Users List > > Subject: RE: PersistensBroker in servlets > > > > > > > > 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]> > > > > > > > -- > 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]>
