multithreading - Thread BLOCK issue in java -


i have thread block issue. please me. in class, have 2 objects. 1 for synchronizing threads , other doing actual business operations.

here class

class a{    object lock = new object();    b b = new b();    public addsomething(){     synchronized(lock){        b.dothis();    }   } } 

i have single instance of class 'a' , multiple threads accessing method a.addsomething(). encountering thread block issue this.

the problem in b.dothis(). if isn't well-behaved (it takes long time execute or may never finish) other threads call addsomething blocked.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -