You are absolutely correct Juergen , I should read the code
more carefully. However if the method where not static
then the use "this." would still be redundant.
Juergen Kreileder wrote:
> > Christopher Hinds writes:
>
> Christopher> [1 ]
> Christopher> [1.1 ]
> Christopher> Th
> The use of 'this' is neither redundant nor allowed here -- the
> methods (recibirPeticion() and enviarPeticion()) are static and
> there is no 'this' in class methods. A 'synchronized static' method
> synchronizes on the class object.
Jeurgen is of course right, sorry I didn't take enough t
> Christopher Hinds writes:
Christopher> [1 ]
Christopher> [1.1 ]
Christopher> The use of "this" is just plain redundant since
Christopher> Cliente.class is by default derived from
Christopher> "java.lang.Object" it is not nessassary to append
Christopher> "this." to
The use of "this" is just plain redundant since Cliente.class
is by
default derived from "java.lang.Object" it is not nessassary to
append "this." to wait() or notify() or any other of the monitor metheds
in this case. Hint : take a look at the core API class hierarchy.
Cheers
Chris
[EMAIL PROTE
On Mon, 14 Dec 1998, Carlos Alberto Roman Zamitiz wrote:
> Hi, I attached my Cliente.java
> I have 2 threads: Receptor and Transmisor. Receptor sends and receives
> data from server, using method recibirPeticion(), forever (well, it sleeps
> 3 seconds). When Transmisor sends data, using method
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() a
> 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
Carlos,
Your problem is with Thread.currentThread().wait()/notifyAll(). Since your method is
synchronized, you own the monitor for "this", not the monitor for currentThread()
(every object has its own monitor).
Try removing "Thread.currentThread()." and leaving just the "wait()/notifyAll()"
call
Hi, I attached my Cliente.java
I have 2 threads: Receptor and Transmisor. Receptor sends and receives
data from server, using method recibirPeticion(), forever (well, it sleeps
3 seconds). When Transmisor sends data, using method enviarPeticion(),
Receptor must wait until Transmisor ends his trans
On Sat, 12 Dec 1998, Carlos Alberto Roman Zamitiz wrote:
> I have a problem with threads: My java client contains 2 threads which
> call to 2 methods. First thread calls method "x" into while(true) but when
> second thread calls method "y", first thread must wait. When second thread
> finish meth
I have a problem with threads: My java client contains 2 threads which
call to 2 methods. First thread calls method "x" into while(true) but when
second thread calls method "y", first thread must wait. When second thread
finish method "y" must notify and first thread will awake.
But I receive thi
11 matches
Mail list logo