You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we are supposed to implement the two methods to resolve concurrent modification exceotion. we can either catch the exception in the scheduler, or protect the critical section r synchronized block around the list.
however, I use synchronized block in the message receptions and catch the exception in the scheduler. This is sort of extra safe thread protection.
would it be possible grading issue resulting in deduction?
The text was updated successfully, but these errors were encountered:
Using a synchronized block is unnecessary unless you are iterating over a list of objects that may change. Simply declaring the list as Collections.SynchronizedList makes specific action calls on the list thread-safe: myList.add(something). However, if you iterate over the list in a message, you should still have a synchronized block.
we are supposed to implement the two methods to resolve concurrent modification exceotion. we can either catch the exception in the scheduler, or protect the critical section r synchronized block around the list.
however, I use synchronized block in the message receptions and catch the exception in the scheduler. This is sort of extra safe thread protection.
would it be possible grading issue resulting in deduction?
The text was updated successfully, but these errors were encountered: