java - Multiple threads accessing same class -


i have 4 threads running @ same time trying access following 4 different methods of same class. want know in order threads execute.

public void method1(); public static void method2();  public synchronized void method3(); public static synchronized method4(); 

method1 called t1 method2 called t2 method3 called t3 method4 called t4

all above methods in same class. totally confused on order threads run. request help.

the threads run semi-parallelly. if not synchronize them, can run in arbitrary order.

the synchronization methods gave in example not effecting each other. first 2 has no synchronization @ all, third syncs on object instance, fourth syncs on class. so, 4 threads can run in particular order.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -