Code example for AtomicReference

Methods: get, set

	private LocationManagerWrapper() {} 
	//protect the reference as an AtomicReference 
	private static final AtomicReference<LocationManager> singleton = new AtomicReference<LocationManager>();
	public static LocationManager get() {
		LocationManager impl = LocationManagerWrapper.singleton.get();
		if(impl == null) {
			LocationManagerWrapper.singleton.set(new LocationManagerWrapper());
			impl = LocationManagerWrapper.singleton.get();
		return impl;
	// Define a listener that responds to location updates 
	private LocationListener locationListener = new LocationListener() {
	    public void onLocationChanged(Location location) { 
	      // Called when a new location is found by the network location provider 
	    public void onStatusChanged(String provider, int status, Bundle extras) {}