Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple Thread allow to change single variable

 
Natesan Prabhakaran
Ranch Hand
Posts: 47
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Vector Instead of ArrayList
 
Campbell Ritchie
Sheriff
Pie
Posts: 47270
52
  • 0
  • 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: 20380
46
Chrome Eclipse IDE Java Windows
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guys..!! I got the result.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic