Code example for AtomicReference

0
		return new ReferenceRegistryStore<V>(); 
	} 
	 
	static class ReferenceRegistryStore<V> implements LifecycleRegistry.Store<Void, V>
	{ 
		private final AtomicReference<V> reference = new AtomicReference<V>();
		 
		/** 
		 * {@inheritDoc} 
		 * @see net.sf.hajdbc.util.concurrent.RegistryStore#setIfAbsent(java.lang.Object, java.lang.Object) 
		 */ 
		@Override 
		public V setIfAbsent(Void key, V value)
		{ 
			return this.reference.compareAndSet(null, value) ? null : this.reference.get();
		} 
 
		/** 
		 * {@inheritDoc} 
		 * @see net.sf.hajdbc.util.concurrent.RegistryStore#get(java.lang.Object) 
		 */