• Post Reply Bookmark Topic Watch Topic
  • New Topic

Session object inside a java method  RSS feed

 
suraj august
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Local variables are thread safe in java .Then how come we get Session object using Session s=SessionFactory.opensession() inside a method is not thread safe ?
 
Paul Clapham
Sheriff
Posts: 22215
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
suraj aryan wrote:Local variables are thread safe in java.


Who told you that? Have a look at this thread: http://www.coderanch.com/t/233488/threads/java/Local-variables-thread-safe for a more detailed discussion of your question.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!