Jump to content


Photo

[Java] dubbio concorrenza thread


This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1 Sgurbat

Sgurbat

    Schiavo

  • Membri
  • PipPipPipPipPipPip
  • 9772 posts

Posted 09 April 2012 - 14:21

Ciao,

mettiamo di avere un Bean di tipo singleton (singleton per lo Spring framework) che fa parte del Service layer che a sua volta richiama un altro Bean singleton del DAO Layer il quale ha un metodo che richiama uno statement SQL e lancia una query su DB.

In teoria task diversi su thread multipli non dovrebbero dare problemi di concorrenza in questo caso giusto?

I due Bean si possono intendere "stateless" corretto?

Non c'è bisogno di rendere synchronized il metodo del DAO o rendere NON singleton i due Bean o sbaglio?

Thanks!

We are what we repeatedly do. Excellence, then, is not an act, but a habit. (Aristotele)


#2 Killer application

Killer application

    Schiavo

  • GRULLINO
  • 11918 posts

Posted 09 April 2012 - 15:01

qui ci dovrebbe essere la risposta.
http://forum.springs...-Singleton-bean
Immagine inserita

#3 Guest_ally_*

Guest_ally_*
  • Ospiti

Posted 09 April 2012 - 17:12

...cosa devi fare e perchè?...