mercredi 20 janvier 2016

What is the difference between Singleton Pattern and Synchronized

I have a problem with "thread safe" method calls in one of my Java EE Beans concerning using the Lucene IndexWriter.

I am unsure if I should solve my problem by implementing a Singleton Pattern or if it is sufficient to add the keyword synchronized to my bean methods.

Can anybody explain what exactly is the difference?

Aucun commentaire:

Enregistrer un commentaire