Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

thread synchronized collection all together

807605Aug 14 2007 — edited Aug 15 2007
Hi guys.

I have an object Zoo. It has a collection with monkeys. Each monkey has it's own thread. Monkey can move on 2d platform(in 8 directions, x y-coordinates). When monkey wants to move she asked if field is free.

The problem is... that if two monkies wants to go to the same position, they do it:(

P.S. synchronized move() - all the same:(
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 12 2007
Added on Aug 14 2007
27 comments
392 views