com.trendrr.oss.concurrent
Class LazyInit

java.lang.Object
  extended by com.trendrr.oss.concurrent.LazyInit

public class LazyInit
extends java.lang.Object

Class to allow lazy initializations, fully threadsafe without any synchronization. usage: if (lazyInit.start()) { try { //initialization code here. } finally { lazyInit.end(); } }

Author:
Dustin Norlander

Constructor Summary
LazyInit()
           
 
Method Summary
 void end()
           
 void reset()
           
 boolean start()
          will return true on the first time it is called, false on every subsequent call.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyInit

public LazyInit()
Method Detail

start

public boolean start()
will return true on the first time it is called, false on every subsequent call. it will block only if another thread is running the initialization code.

Returns:

end

public void end()

reset

public void reset()