Package org.apache.felix.ipojo.handler.temporal.ServiceUsage

Examples of org.apache.felix.ipojo.handler.temporal.ServiceUsage.Usage


     * @param method : Method object.
     * @see org.apache.felix.ipojo.MethodInterceptor#onFinally(java.lang.Object, java.lang.reflect.Method)
     */
    public void onFinally(Object pojo, Method method) {
        if (m_usage != null) {
            Usage usage = (Usage) m_usage.get();
            if (usage.m_stack > 0) {
                if (usage.dec()) {
                    // Exit the method flow => Release all objects
                    usage.clear();
                    m_usage.set(usage); // Set the Thread local as value has been modified
                }
            }
        }
    }
View Full Code Here


            } else {
                return m_proxyObject;
            }
        } else {
            // Initialize the thread local object is not already touched.
            Usage usage = (Usage) m_usage.get();
            if (usage.m_stack == 0) { // uninitialized usage.
                if (isAggregate()) {
                    if (m_collection) {
                        Collection svc = new ArrayList(refs.length)// Use an array list as collection implementation.
                        for (int i = 0; i < refs.length; i++) {
                            svc.add(getService(refs[i]));
                        }
                        usage.m_object = svc;
                    } else {
                        Object[] svc = (Object[]) Array.newInstance(getSpecification(),
                                refs.length);
                        for (int i = 0; i < svc.length; i++) {
                            svc[i] = getService(refs[i]);
                        }
                        usage.m_object = svc;
                    }
                } else {
                    usage.m_object = getService(refs[0]);
                }
                usage.inc(); // Start the caching, so set the stack level to 1
                m_usage.set(usage);
            }
            return usage.m_object;
        }
       
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.handler.temporal.ServiceUsage.Usage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.