I have multiple synchronized static methods in a class.
public class DoSomething {
public static synchronized void fun1() {
/*do something time consuming*/
}
public static synchronized void fun2() {
/*do something time consuming*/
}
.
.
}
Right now only one thread is allowed to execute any of the synchronized function in the class. Which is not efficient because the functions are independent of each other and can be run parallelly. How can can I make them independent of each other but only one thread is allowed per method with minimal changes to class.