title: Wait for listener completion
body: <p>I will be talking purely conceptual here.</p>
  
  <p>I have a class which has a listener attached to it which does <strong><em>something</em></strong>.
  I have a whole array of the objects that are constructed from that class</p>
  
  <p>I also have a static method <code>foo()</code> which access that array and then does <strong><em>something else</em></strong>.</p>
  
  <p>Doing <strong><em>something else</em></strong> triggers the listener and if I don't pause <strong><em>something else</em></strong> until <strong><em>something</em></strong> is done, code doesn't work. <code>foo()</code> knows when the listener is triggered.</p>
  
  <p>Also, listener has a capability to directily invoke a listener on another object that was constructed out of the same class. <code>foo()</code> can't know if this will happen or not, or how many times.</p>
  
  <p>So how can I force <code>foo()</code> to wait for listener to execute, and then, if the listener hasn't triggered a chain reaction, continue where it left off, or otherwise wait for any triggered listener to finish executing?</p>