N
Neel
Hi friends,
I have a small query.
'm new to Java so was unable to figure out how to solve it.
[ I couldn't find that group dedicated to Java Threads so posted my
query in this group.]
My query is...
I have a linked list in which ONE thread always inserts data and
MULTIPLE threads (say servicing threads) fetches data and process the
data.....
I want this to be synchronized (race condition should not happen).
Also I maintain a count of number of consuming threads (say, int
thread_count).
This might make query little confusing but... what I want is, I
maintain count of total threads that can fetch data.
whenever anyone has finished serving one customer, it is terminated
and whenever new customer in inserted in the linked list, a new
service thread is created and thread_count is incremented.
The situation where synchronizing thread_count comes into picture
is.... "when the servicing thread terminates, it check the
thread_count. If the value is less than 2, it will not terminate but
continue in infinite loop. I want there should be atleast ONE service
thread always there.
Thanks in advance.
I have a small query.
'm new to Java so was unable to figure out how to solve it.
[ I couldn't find that group dedicated to Java Threads so posted my
query in this group.]
My query is...
I have a linked list in which ONE thread always inserts data and
MULTIPLE threads (say servicing threads) fetches data and process the
data.....
I want this to be synchronized (race condition should not happen).
Also I maintain a count of number of consuming threads (say, int
thread_count).
This might make query little confusing but... what I want is, I
maintain count of total threads that can fetch data.
whenever anyone has finished serving one customer, it is terminated
and whenever new customer in inserted in the linked list, a new
service thread is created and thread_count is incremented.
The situation where synchronizing thread_count comes into picture
is.... "when the servicing thread terminates, it check the
thread_count. If the value is less than 2, it will not terminate but
continue in infinite loop. I want there should be atleast ONE service
thread always there.
Thanks in advance.