Java : Instruction Flow not clear
<p>I was going through some random java code and came across this peice of code, I am trying to understand the flow and having hard time understanding how the actual implementation of the class, actual operation done by the class so my basic questions is <code>WhatDoIDo</code> class actually do ? Any guidance would be apprecaited. </p>

<p><em><strong>Q:</em></strong>
What would be the unit test case which explains the improved performance because of implementing in the concurrent environment. </p>

<p><em><strong>Code</em></strong></p>

<pre><code>public class WhatDoIDo{
    private X x;
    private boolean b;
    private Object o;

    public WhatDoIDo(X x) {
        this.x = x;
    }

    synchronized Object z() {
        if (!b) {
            o = x.y();
            b = true;
        }
        return o;
    }

    public interface X {
        Object y();
    }
}
</code></pre>
