| Author |
Multiple Thread allow to change single variable
|
Natesan Prabhakaran
Ranch Hand
Joined: Jul 11, 2006
Posts: 47
|
|
Hi All,
I am having a small doubt in Threads. In my application, I am creating a ArryList in ClassA, adding 100 different values. Now I am passing this ArrayList to ClassB. Here, creating 'n' number of threads. All the threads are making some chages on the same ArrayList. If one thread made any changes, It should reflect to another.
Can any one Help me for this condition. Thanks.
Regards,
Prabhakaran
|
Regards,
Prabhakaran.N
|
 |
Siva Arun
Greenhorn
Joined: Feb 23, 2010
Posts: 28
|
|
|
Try Vector Instead of ArrayList
|
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32641
|
|
|
To expand on what Siva Arun said, that sounds like a synchronisation problem, that changes are made at the same time by your many threads.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Let's move this to Threads and Synchronization.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Natesan Prabhakaran
Ranch Hand
Joined: Jul 11, 2006
Posts: 47
|
|
|
Thanks Guys..!! I got the result.
|
 |
 |
|
|
subject: Multiple Thread allow to change single variable
|
|
|