Hi,
why synchronized (this)
is not a good option here ?
Thanks
About Question enthuware.ocpjp.v7.2.1536 :
Moderator: admin
-
- Posts: 27
- Joined: Sat Aug 31, 2013 5:38 pm
- Contact:
-
- Site Admin
- Posts: 10405
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1536 :
Synchronizing on "this" will synchronize on the Producer instance and Consumer instance, not on the data instance. So producer thread and consumer threads will be able to access data simultaneously, which you do not want.
HTH,
Paul.
HTH,
Paul.
Who is online
Users browsing this forum: No registered users and 18 guests