This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple Thread allow to change single variable

 
Natesan Prabhakaran
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Siva Arun
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Vector Instead of ArrayList
 
Campbell Ritchie
Sheriff
Pie
Posts: 50270
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's move this to Threads and Synchronization.
 
Natesan Prabhakaran
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guys..!! I got the result.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic