anoosh wrote:
>> I'm new to java [sic], and want to write a program.
>> The aim is to create a Supervisor class.This class Supervises the
Your posts will be a little easier to read if you put two spaces between
sentences.
>> creation of a thread(repeatedly in a special time in background while
Also around parenthetical remarks.
Whitespace is not the same as no space.
>> this class is running) and insert the created thread in a thread
>> pool,and then selecets a one of these threads and also assigns the
>> selected thread to critical environment.
>> The thread consists some field,but the most important field is request
Commas, too.
>> field.This field records the last time that this thread send a request
>> signal to the critical environment for enterence. I mean each of these
>> thread which stored in the pool must send this request randomly to the
>> critical environment and record it.
>> Now would you please write some skeleton of these two
>> classes(Supervisor and thread) for me?
> Multi-posting? Abusing the help of people
> on usenet newsgroups?
[quoted text clipped - 8 lines]
>
> (X-post to c.l.j.p./h., w/ f-u to c.l.j.p. only)
OP: this problem seems a bit beyond the "new to Java" phase, but you should
definitely read /Java Concurrency in Practice/, by Brian Goetz, et al. It
covers the use of threads, locks, notifications, timers and the lot.
The java.util.Timer class will help you with the timer part.
The java.util.concurrent package contains a number of classes and interfaces
you can use for this, notably Executor, ExecutorService and Future. Also, go
to java.sun.com and read the concurrent programming tutorials.

Signature
Lew