Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

static synchronized methods  RSS feed

 
kumar Nagesh
Greenhorn
Posts: 12
Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have called two static synchronized methods of a class at a time will it work one by one or simultaneously
 
Patel Chintan
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It will work one by one.
 
Angel Taveras
Ranch Hand
Posts: 84
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If these methods belongs to the same type of class, they will run one by one even if you are using multiple threads to execute these methods. The synchronized static methods use the .class object as the Thread lock

Regards,
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!