• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

@Singleton and @Stateless

Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
  • 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

Evacuate the building! Here, take this tiny ad with you:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic