Java Threading - how to retrieve values from diff threads?

View: New views
1 Messages — Rating Filter:   Alert me  

Java Threading - how to retrieve values from diff threads?

by Barath :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have 3 classes,
 1. MainClass.java -- just invoke ThreadClass 3 times.
 2. ThreadClass.java -- extends Thread and call getRandomNumber method in RandomNo.java.
 3. RandomNo.java -- has "int getRandomNumber()" method which return random number.

I need to get the random numbers from each thread invoked by the Mainclass.

How to proceed?

Note: I used a static variable in MainClass and stored the random number of each thread to this variable in ThreadClass. But i this is bad approach because static holds previous data too.(in server based deploy application).

Barath.
LightInTheBox - Buy quality products at wholesale price!