Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

thread interferrence

0 views
Skip to first unread message

Lloyd

unread,
Oct 27, 2001, 7:36:45 PM10/27/01
to
Hi all,

whilst making a simple(ish) corba app using java I've been hitting my head
against a threading problem and as I don't often use them can't think of the
right design pattern to save me.

basically I have the constructore pausing with a wait() at a point and it
should resume when one of the other methods in the object is called. I have
tried putting notify() or notifyAll() witrhin that called method to awake
the main thread but I can't as I am constantly getting
illegalMonitorStateExceptions as the method can't mess with the lock on the
main thread.

anyone know a way around this? possibly a different design style?


My thanks -
Lloyd

p.s. below is part of the runtime error


java.lang.IllegalMonitorStateException
at java.lang.Object.notifyAll(Native Method)
at MatchMakerClient.swap(MatchMakerClient.java:87)
at Matching.AveragerPOA._invoke(AveragerPOA.java:41)
at
org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java
:207)


Lloyd

unread,
Oct 27, 2001, 8:06:39 PM10/27/01
to
my apologies

just attempted the solution described below in this newsgroup.

I now have an object I creat a lock on in the main thread, then when the
method is called by an external party I run a synchronized notifyall on that
object.

still a runtime error but now

ERROR : java.lang.IllegalMonitorStateException
java.lang.IllegalMonitorStateException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:420)
at MatchMakerClient.<init>(MatchMakerClient.java:36)
at MatchMakerClient.main(MatchMakerClient.java:65)

joy


Patricia Shanahan

unread,
Oct 27, 2001, 8:25:54 PM10/27/01
to

This means you are trying to call an object's wait method without being
synchronized on that particular object.

Patricia

Message has been deleted
0 new messages