From: "Christophe Demez" <[EMAIL PROTECTED]>
> I need to create a bean that :
> 1 - will be a singleton
> 2 - Must never been released
> 3 - Must start after the EJB server is ready and all other
> EJB are deployed.
> I do not know how to do this !
1- and 2- have been discussed extensively here, refer to the archives, you
will probably find your answer there.
3- is more interesting and I can think of at least two possible solutions:
a) If your container supports JMX,you probably have everything you need to
be informed when an EJB is deployed, when the server is started, etc... It's
probably the most efficient solution and is non-intrusive on your EJB's.
The only drawback is that JMX is not part of J2EE, so your application will
not necessarily be portable to another J2EE server.
b) You could implement an "EJB semaphore". The drawback is that you need
each of your EJB's to participate in the effort. First of all, all of them
should publish a message on a JMS Queue once they have been deployed. This
Queue should have only one listener, a Synchronizer (e.g. a
MessageDrivenBean) which will register which EJB's have been deployed.
Once they have all been deployed, the Synchronizer can notify your main EJB
that it can start (once again, either through JMS, JMX or RMI).
You can have several variations on this model (for example, your bean and
the Synchronizer could be the same class, although decoupling them can prove
useful as well).
--
Cedric
===========================================================================
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".