blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java [64:133]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class BeanRecipe extends AbstractRecipe {

    static class UnwrapperedBeanHolder {
        final Object unwrapperedBean;
        final BeanRecipe recipe;

        public UnwrapperedBeanHolder(Object unwrapperedBean, BeanRecipe recipe) {
            this.unwrapperedBean = unwrapperedBean;
            this.recipe = recipe;
        }
    }

    public class VoidableCallable implements Callable<Object>, Voidable {

        private final AtomicReference<Object> ref = new AtomicReference<Object>();
        
        private final Semaphore sem = new Semaphore(1);
        
        private final ThreadLocal<Object> deadlockDetector = new ThreadLocal<Object>();
        
        public void voidReference() {
            ref.set(null);
        }

        public Object call() throws ComponentDefinitionException {
            Object o = ref.get();
            
            if (o == null) {
                if(deadlockDetector.get() != null) {
                    deadlockDetector.remove();
                    throw new ComponentDefinitionException("Construction cycle detected for bean " + name);
                }
                
                sem.acquireUninterruptibly();
                try {
                    o = ref.get();
                    if (o == null) {
                        deadlockDetector.set(this);
                        try {
                            o = internalCreate2();
                            ref.set(o);
                        } finally {
                            deadlockDetector.remove();
                        }
                    }
                } finally {
                  sem.release();
                }
            }
            
            return o;
        }

    }

    private static final Logger LOGGER = LoggerFactory.getLogger(BeanRecipe.class);

    private final ExtendedBlueprintContainer blueprintContainer;
    private final LinkedHashMap<String,Object> properties = new LinkedHashMap<String,Object>();
    private final Object type;

    private String initMethod;
    private String destroyMethod;
    private List<Recipe> explicitDependencies;
    
    private Recipe factory;
    private String factoryMethod;
    private List<Object> arguments;
    private List<String> argTypes;
    private boolean reorderArguments;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java [62:131]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class BeanRecipe extends AbstractRecipe {

    static class UnwrapperedBeanHolder {
        final Object unwrapperedBean;
        final BeanRecipe recipe;

        public UnwrapperedBeanHolder(Object unwrapperedBean, BeanRecipe recipe) {
            this.unwrapperedBean = unwrapperedBean;
            this.recipe = recipe;
        }
    }

    public class VoidableCallable implements Callable<Object>, Voidable {

        private final AtomicReference<Object> ref = new AtomicReference<Object>();

        private final Semaphore sem = new Semaphore(1);

        private final ThreadLocal<Object> deadlockDetector = new ThreadLocal<Object>();

        public void voidReference() {
            ref.set(null);
        }

        public Object call() throws ComponentDefinitionException {
            Object o = ref.get();

            if (o == null) {
                if(deadlockDetector.get() != null) {
                    deadlockDetector.remove();
                    throw new ComponentDefinitionException("Construction cycle detected for bean " + name);
                }

                sem.acquireUninterruptibly();
                try {
                    o = ref.get();
                    if (o == null) {
                        deadlockDetector.set(this);
                        try {
                            o = internalCreate2();
                            ref.set(o);
                        } finally {
                            deadlockDetector.remove();
                        }
                    }
                } finally {
                    sem.release();
                }
            }

            return o;
        }

    }

    private static final Logger LOGGER = LoggerFactory.getLogger(BeanRecipe.class);

    private final ExtendedBlueprintContainer blueprintContainer;
    private final LinkedHashMap<String,Object> properties = new LinkedHashMap<String,Object>();
    private final Object type;

    private String initMethod;
    private String destroyMethod;
    private List<Recipe> explicitDependencies;

    private Recipe factory;
    private String factoryMethod;
    private List<Object> arguments;
    private List<String> argTypes;
    private boolean reorderArguments;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



