/**
 * Copyright (C) FuseSource, Inc.
 * http://fusesource.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.fusesource.fabric.api.scr;

import java.util.concurrent.atomic.AtomicBoolean;

/**
 * An abstract base class for validatable components.
 *
 * @author Thomas.Diesler@jboss.com
 * @since 13-Sep-2013
 */
public abstract class AbstractComponent implements Validatable {

    private final AtomicBoolean active = new AtomicBoolean();

    public void activateComponent() {
        active.set(true);
    }

    public void deactivateComponent() {
        active.set(false);
    }

    @Override
    public boolean isValid() {
        return active.get();
    }

    @Override
    public void assertValid() {
        if (isValid() == false) {
            RuntimeException rte = new InvalidComponentException();
            rte.printStackTrace();
            throw rte;
        }
    }
}
@@ -661,58 +661,8 @@
 r;%0A%0A
-import java.util.concurrent.atomic.AtomicBoolean;%0A
 %0A/**
@@ -718,16 +718,24 @@
 ents.%0A *
+ %7B@link%7D
 %0A * @aut
@@ -863,64 +863,479 @@
     
-private final AtomicBoolean active = new AtomicBoolean()
+/* This uses volatile to make sure that every thread sees the last written value%0A     *%0A     * - The use of AtomicBoolean would be wrong because it does not guarantee that state written%0A     *   prior to an unsynchronized call to activateComponent() is also seen%0A     *%0A     * - Synchronizing all methods in here would also work, but would effectively cause%0A     *   a lock acquisition on every public method in every component%0A     */%0A    private volatile boolean active
 ;%0A%0A 
@@ -1389,18 +1389,15 @@
 tive
-.set(
+ = 
 true
-)
 ;%0A  
@@ -1459,19 +1459,16 @@
 tive
-.set(
+ = 
 false
-)
 ;%0A  
@@ -1542,14 +1542,8 @@
 tive
-.get()
 ;%0A  
@@ -1609,25 +1609,14 @@
 if (
-isValid() == fals
+!activ
 e) %7B

Make AbstractComponent use a volatile flag instead of AtomicBoolean