• Post Reply Bookmark Topic Watch Topic
  • New Topic

Session object inside a java method

 
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: 21976
36
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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!