This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Singleton in EJB  RSS feed

 
Leena Diwan
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends !
I was asked when will one need to go for a Singleton class in and EJB application ?
I mean which condition ? when will you want this ?
Can anyone help ?
Thank you all in advance..
Leena
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One recommended approach is to implement the functionality desired from a Singleton as a CORBA or RMI object and bind it in the JNDI namespace. All clients can use JNDI to look up this object and use it.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I describe one situation for using singletonhere.
Kyle
 
sandy gupta
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever u feel that .............
:roll: "ummmmmmmmmmmmmmmmmmmmmmmmmmmmm i should have used a static class here but for some reason u can not, use a SINGLETON .........."
 
Manish_Mudgal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Leena Diwan:
Hello friends !
I was asked when will one need to go for a Singleton class in and EJB application ?
I mean which condition ? when will you want this ?
Can anyone help ?
Thank you all in advance..
Leena
 
Manish_Mudgal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Leena Diwan:
Hello friends !
I was asked when will one need to go for a Singleton class in and EJB application ?
I mean which condition ? when will you want this ?
Can anyone help ?
Thank you all in advance..
Leena

Hi,
If you are using Serive locator pattern then you can make that singleton,to give one service at a time
 
Viswanatha GB
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Leena,
The Singleton's purpose is to control object creation, limiting the number to one but allowing the flexibility to create more objects if the situation changes. Since there is only one Singleton instance, any instance fields of a Singleton will occur only once per class, just like static fields.
Singletons often control access to resources such as
1.Database connections or
2.sockets
Thanks
viswa
Viswanatha GB
1.
[ May 23, 2002: Message edited by: viswagb ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!