Re: Problems with Threads (Code included)

1998-12-15 Thread Christopher Hinds
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

Re: Problems with Threads (Code included)

1998-12-14 Thread zun
> 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

Re: Problems with Threads (Code included)

1998-12-14 Thread Juergen Kreileder
> 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

Re: Problems with Threads (Code included)

1998-12-14 Thread Christopher Hinds
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

Re: Problems with Threads (Code included)

1998-12-14 Thread zun
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

Re: Problems with Threads (Code included)

1998-12-14 Thread Christopher Hinds
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

Re: Problems with Threads (Code included)

1998-12-14 Thread Juergen Kreileder
> 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

Re: Problems with Threads (Code included)

1998-12-14 Thread Mario Camou
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

Re: Problems with Threads (Code included)

1998-12-14 Thread Carlos Alberto Roman Zamitiz
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

Re: Problems with Threads

1998-12-13 Thread zun
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

Problems with Threads

1998-12-12 Thread Carlos Alberto Roman Zamitiz
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