Code example for AtomicBoolean

Methods: compareAndSet

0
		 
		if (timeout != null) {
			mHandler = new Handler();
			mTimeoutWatchdog = new Runnable() {
				@Override public void run() { 
					if (mFinished.compareAndSet(false, true)) {
						Intent returnIntent = new Intent();
						returnIntent.putExtra(INTENT_ARG_PREFIX + "failed", true);
						returnIntent.putExtra(INTENT_ARG_PREFIX + "failure_code", 0);
						returnIntent.putExtra(INTENT_ARG_PREFIX + "failure_desc", "Timeout");
						NativeBrowser.this.setResult(Activity.RESULT_OK, returnIntent);
						NativeBrowser.this.finish();
					} 
				} 
			}; 
			mHandler.postDelayed(mTimeoutWatchdog, Integer.parseInt(timeout));
		} 
	} 
}