title: Implement a blocking function call in Java
body: <p>What is the recommended / best way to implement a blocking function call in Java, that can be later unblocked by a call from another thread?</p>
  
  <p>Basically I want to have two methods on an object, where the first call blocks any calling thread until the second method is run by another thread:</p>
  
  <pre><code>public class Blocker {
  
    /* Any thread that calls this function will get blocked */
    public static SomeResultObject blockingCall() {
       // ...      
    }
  
    /* when this function is called all blocked threads will continue */
    public void unblockAll() {
       // ...
    }
  
  } 
  </code></pre>
  
  <p>The intention BTW is not just to get blocking behaviour, but to write a method that blocks until some future point when it is possible to compute the required result.</p>