Code example for AtomicReference

Methods: getAndSet

0
        final BroadcastReceiver receiver = mReceiver.getAndSet(null);
        if (receiver != null) {
            mContext.unregisterReceiver(receiver);
        } 
    } 
 
    @Override 
    protected void finalize() throws Throwable { 
        if (mReceiver.get() != null) {
            Log.e(TAG, "RegisteredServicesCache finalized without being closed");
        } 
        close(); 
        super.finalize(); 
    } 
 
    void dump(ArrayList<ComponentInfo> components) {
        for (ComponentInfo component : components) {
            Log.i(TAG, component.toString());
        } 
    }