java - Observer Design Pattern -


Observer Design Pattern , the topic notifies all observers by calling update () A method of conducting each supervisor

  notify zero () (for (supervisor: supervisors) {observer.update (this);}}  

But the problem here is that each supervisor is updated in the sequence and the update operation is not called for the supervisor. Not all supervisors are updated unless a supervisor has an infinite loop for the update, then all supervisors after that will not be notified.

< P> Question:

  1. Is there any way to solve this problem?
  2. If so, would that be a good example?

The classic design pattern does not include similarity and threading. For the observers, it is necessary to create N threads. However be careful, because it needs to secure their thread safely.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -