Code example for AtomicBoolean

Methods: getAndSet

0
 
    /** Receive the alarm - start the synchronize service! */ 
    @Override 
    public void onStart(Intent intent, int startId) {
        try { 
            if(intent != null && !started.getAndSet(true)) {
                startSynchronization(this);
            } 
        } catch (Exception e) {
            exceptionService.reportError(getSyncUtilities().getIdentifier() + "-bg-sync", e); //$NON-NLS-1$
        } 
    } 
 
    /** Start the actual synchronization */ 
    private void startSynchronization(Context context) {
        if(context == null || context.getResources() == null)
            return; 
 
        ContextManager.setContext(context);
 
Contextual code suggestions in your IDE  Get Codota for Java