Posted By:
Uday_Kishore
Posted On:
Tuesday, October 28, 2003 11:18 PM
I have a abstract base class Base with a synchronized (non-static) method public synchronized void publish() . I have 2 concrete classes Derived1 and Derived2 , both of them extend from Base class. Both these classes override the publish method of the Base class. In the Derived1 class, the overriden version of publish method is declared as synchronized and calls super.publish() In the Derived2 class, the overriden version of publish method is NOT declared as synchronized and also calls super.publish() The entire application is heavily multi-threaded and there are
More>>
I have a abstract base class
Base
with a
synchronized
(non-static) method
public synchronized void publish()
.
I have 2 concrete classes
Derived1
and
Derived2
, both of them extend from
Base
class. Both these classes override the
publish
method of the
Base
class.
In the
Derived1
class, the overriden version of
publish
method is declared as
synchronized
and calls
super.publish()
In the
Derived2
class, the overriden version of
publish
method is NOT declared as
synchronized
and also calls
super.publish()
The entire application is heavily multi-threaded and there are 2 threads in the process which are getting into deadlock with one-another. One of them calls
publish
method on a
Derived1
object. Another calls
publish
method on a
Derived2
object.
Can anyone explain why this is happenning and what are the possible solutions?
Does marking a method of an abstract base class as
synchronized
cause some problems that need special addressing?
<<Less