This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

static synchronized methods  RSS feed

 
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
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It will work one by one.
 
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,
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!