Sington in ASP.NET
Starting with EJB... In java (or virtually any language) you can easily make a class singleton by making the constructor private and such. But it becomes more complicated in an EJB container, as the container can spawn multiple instances of this singleton. So in environment like JBoss, it provides special annotation to define true singleton in EJB container - by looking at that annotation, JBoss knows that it should only create at most one instance of this class.
Now I would like make the analog that ASP.NET behaves just like EJB container in this case - the system spawns instances as needed. Now the question is how to gurantee the a singleton is true at application level. One solution I can see is by adding it to Application object, any other ideas?
|