Code example for AtomicBoolean

0
 
    public SyncBackgroundService() { 
        DependencyInjectionService.getInstance().inject(this);
    } 
 
    private final AtomicBoolean started = new AtomicBoolean(false);
 
    /** 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 */ 
Contextual code suggestions in your IDE  Get Codota for Java