On Wed, 2003-11-26 at 18:28, Juan Pablo Lorandi wrote:
> > >
> > > Sure:
> > >
> > > private static DataSource ds = null;
> > > private static InitialContext ic = null;
> > >
> > > private void init() {
> > > if (ic == null)
> > > initHomes();
> > > }
> > > private static synchronized void initHomes() {
> > > if (ic == null) {
> > > ic = new InitialContext();
> > > ds = (DataSource) ic.lookup("someDataSource);
> > > }
> > > }
> > >
> >
> > Sorry but I didn't understood your example, unless you'd
> > referred to ordinary classes, right? In stateless EJB there
> > is no such thing as
> > init() method for initialization. Or am I wrong?
>
> Sorry, my mistake. This is for a stateless session bean. You'd have to
> include a call to init() in every business method invocation:
>
> public void methodA() {
> init();
> //rest of code goes here.
> }
Just one more thing, the "synchronized" keyword doesn't raise problems
in the EJBs or since it's in a "static" method there is no problem?
regards,
Pedro Salazar.
--
PS
[EMAIL PROTECTED]
PGP:0E129E31D803BC61
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".