I Think this was stated before but anyway here goes again. The
Cliente.class is derived from java.lang.Object and every object has a
Monitor. The Monitor for an object "this" can only be accessed
by a synchronized methed(s) of the object , which is this case is
Cliente.class in recibirPeticion() and enviarPeticion().

By using "Thread.currentThread().wait()/notifyAll()" in this code, the
monitor being asked for
is the Monitor for the class "java.lang.Thread" not the Cliente.class.

Simply remove "Thread.currentThread()." from the invocations of wait() and
notifyAll()
and the exception should go away.

Cheers
Chris

Juergen Kreileder wrote:

> >>>>> Mario Camou writes:
>
>     Mario> Carlos,
>     Mario> Your problem is with
>     Mario> Thread.currentThread().wait()/notifyAll(). Since your
>     Mario> method is synchronized, you own the monitor for "this", not
>
> No. Since the the methods are 'synchronized' and 'static', he
> owns the monitor for 'Cliente.class'
>
>         Juergen
>
> --
> Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
> Baroper Strasse 301, D-44221 Dortmund, Germany
> Phone: ++49 231/755-5806, Fax: ++49 231/755-5802
begin:vcard 
n:Hinds;Christopher 
tel;fax:718-789-7906
tel;home:718-789-7906
x-mozilla-html:FALSE
org:Heuristic Systems, Inc.
version:2.1
email;internet:[EMAIL PROTECTED]
title:Chief Engineer - President
adr;quoted-printable:;;160 FIFTH AVE=0D=0ASUITE 4R;Park Slope;NY;11217;USA
x-mozilla-cpt:;0
fn:Christopher Hinds
end:vcard

Reply via email to