Code example for AtomicReference

Methods: get, set

0
    public static void broadcastAccountsChangedWithDelay(Context context, long delay, TimeUnit unit) {
        EXECUTOR.schedule(delayedAccountsChangedBroadcastOf(context), delay, unit);
    } 
 
    private static Runnable delayedAccountsChangedBroadcastOf(final Context context) {
        delayedAccountsChangedBroadcast.set(new Runnable() {
            public void run() { 
                if (delayedAccountsChangedBroadcast.get() == this) {
                    broadcastAccountsChanged(context); // alternative to accountManager.setUserData(account, "broadcast", "true");
                } 
            } 
        }); 
 
        return delayedAccountsChangedBroadcast.get();
    } 
 
    private static void broadcastAccountsChanged(Context context) {
        context.sendBroadcast(ACCOUNTS_CHANGED_INTENT,"com.dashwire.config.PERM_CONFIG_INTERNAL");
        DashLogger.d(TAG, "broadcastAccountsChanged().");
    }