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
Milestone C in Restaurant v2.2 requires us to use either synchronized lists and exception catching to prevent concurrent modification exceptions, and we have to use both at least once.
I think this may result in problems because, for example, let's say we "protect" waiter's data by catching the exception in its scheduler. If the waiter's thread is modifying the data, and some other thread tries to modify it via a message, that would produce an exception in the other thread that wouldn't be caught unless it implemented the same method.
Am I correct? What should we do about this? Thanks!
The text was updated successfully, but these errors were encountered:
Prof W. will go over this in class. However, you are right that this could cause each thread to block each other. Bring up a scenario in class where this would happen and he will discuss it with the class.
You can avoid the blocks by not including action calls in the synchronized sections of your code. however, the chances that your code will ever block are extremely low.
Milestone C in Restaurant v2.2 requires us to use either synchronized lists and exception catching to prevent concurrent modification exceptions, and we have to use both at least once.
I think this may result in problems because, for example, let's say we "protect" waiter's data by catching the exception in its scheduler. If the waiter's thread is modifying the data, and some other thread tries to modify it via a message, that would produce an exception in the other thread that wouldn't be caught unless it implemented the same method.
Am I correct? What should we do about this? Thanks!
The text was updated successfully, but these errors were encountered: