• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

@Singleton and @Stateless

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can any one explain when to use singleton and when to use stateless?

I am clear that stateless bean will be created by the container based on bandwidth(number of request using the created bean).

But i am not quite clear how singleton is related to stateless bean?

Can you please explain?
 
Ranch Hand
Posts: 214
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A singleton is a type of stateless session bean that is instantiated once and only once per application per JVM. I think the main use case is to share state between components in an application. Basically the same use case as the standard singleton pattern, or anti-pattern depending on your point of view.

A singleton might be a good choice for running some piece of code on a periodic basis, for example.

Check this thread

reply
    Bookmark Topic Watch Topic
  • New Topic