So what are the rules regarding Singleton pattern in EJB? Is it or is it not legal to have a separate Singleton object being accessed by various beans in the server?
For example, let's say I wanted a share pool for a Flyweight object or something like that. OK or no?
go to inprise application server news group and search for singleton in subject, you will find several threads discussing about Singleton Pattern and how to implement it.
News group is: inprise.public.appserver
I hope it helps.
You should always be aware that your beans could run in a clustered environment, involving several servers and thus several VMs. The way singletons are usually implemented in Java only ensure that there is one single instance per VM, which I guess is not what you want to have.
So, if you really need a singleton (which is not always a good solution, for performance reasons), you should implement it using standard RMI or CORBA.