Code example for AtomicBoolean

0
		 * started. 
		 *  
		 * This flag guarantees that either cancelAll() or run() manages this 
		 * task post execution, but not both. 
		 */ 
		private AtomicBoolean managed = new AtomicBoolean();
 
		public Task(String id, int delay, String serial) {
			if (!"".equals(id)) {
				this.id = id;
			} 
			if (delay > 0) {
				remainingDelay = delay;
				targetTimeMillis = System.currentTimeMillis() + delay;
			} 
			if (!"".equals(serial)) {
				this.serial = serial;
			} 
		} 
 
		@Override