Examples of usage


Examples of org.apache.felix.ipojo.handlers.dependency.ServiceUsage.Usage

     * @see org.apache.felix.ipojo.FieldInterceptor#onGet(java.lang.Object, java.lang.String, java.lang.Object)
     */
    public Object onGet(Object pojo, String fieldName, Object value) {

        // Initialize the thread local object is not already touched.
        Usage usage = (Usage) m_usage.get();
        if (usage.m_stack == 0) { // uninitialized usage.
            createServiceObject(usage);
            usage.inc(); // Start the caching, so set the stack level to 1
            m_usage.set(usage);
        }
        if (! m_isProxy) {
            return usage.m_object;
        } else {
View Full Code Here

Examples of org.apache.felix.ipojo.handlers.dependency.ServiceUsage.Usage

     * @param args : arguments
     * @see org.apache.felix.ipojo.MethodInterceptor#onEntry(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
     */
    public void onEntry(Object pojo, Method method, Object[] args) {
        if (m_usage != null) {
            Usage usage = (Usage) m_usage.get();
            usage.incComponentStack(); // Increment the number of component access.
            if (usage.m_stack > 0) {
                usage.inc();
                m_usage.set(usage); // Set the Thread local as value has been modified
            }
        }
    }
View Full Code Here

Examples of org.apache.felix.ipojo.handlers.dependency.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();
            usage.decComponentStack();
            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

Examples of org.apache.felix.ipojo.handlers.dependency.ServiceUsage.Usage

     * Reset the thread local cache if used.
     * For testing purpose only.
     */
    public void resetLocalCache() {
        if (m_usage != null) {
            Usage usage = (Usage) m_usage.get();
            if (usage.m_stack > 0) {
                createServiceObject(usage);
            }
        }
    }
View Full Code Here

Examples of org.apache.felix.ipojo.handlers.dependency.ServiceUsage.Usage

        // Check that we're in proxy mode.
        if (!m_isProxy) {
            throw new IllegalStateException("The dependency has not enabled the `proxy` mode.");
        }

        Usage usage = (Usage) m_usage.get();
        if (usage.m_stack == 0) { // uninitialized usage.
            if (usage.m_componentStack > 0) {
                // We comes from the component who didn't touch the service.
                // So we initialize the usage.
                createServiceObject(usage);
                usage.inc(); // Start the caching, so set the stack level to 1
                m_usage.set(usage); // Required by Dalvik.
                if (isAggregate()) {
                    Object obj = usage.m_object;
                    if (obj instanceof Set) {
                        List<Object> list = new ArrayList<Object>();
View Full Code Here

Examples of org.apache.felix.ipojo.handlers.dependency.ServiceUsage.Usage

     * @see org.apache.felix.ipojo.FieldInterceptor#onGet(java.lang.Object, java.lang.String, java.lang.Object)
     */
    public Object onGet(Object pojo, String fieldName, Object value) {

        // Initialize the thread local object is not already touched.
        Usage usage = m_usage.get();
        if (usage.m_stack == 0) { // uninitialized usage.
            createServiceObject(usage);
            usage.inc(); // Start the caching, so set the stack level to 1
            m_usage.set(usage); // Required by Dalvik
        }
        if (!m_isProxy) {
            return usage.m_object;
        } else {
View Full Code Here

Examples of org.apache.felix.ipojo.handlers.dependency.ServiceUsage.Usage

     * @param args   : arguments
     * @see org.apache.felix.ipojo.MethodInterceptor#onEntry(java.lang.Object, java.lang.reflect.Member, java.lang.Object[])
     */
    public void onEntry(Object pojo, Member method, Object[] args) {
        if (m_usage != null) {
            Usage usage = m_usage.get();
            usage.incComponentStack(); // Increment the number of component access.
            if (usage.m_stack > 0) {
                usage.inc();
                m_usage.set(usage); // Set the Thread local as value has been modified
            }
        }
    }
View Full Code Here

Examples of org.apache.felix.ipojo.handlers.dependency.ServiceUsage.Usage

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

Examples of org.cloudfoundry.client.lib.domain.InstanceStats.Usage

  public String getColumnText(Object element, int columnIndex) {
    if (element instanceof InstanceStatsAndInfo) {
      InstanceStatsAndInfo statsAndInfo = (InstanceStatsAndInfo) element;
      InstanceStats stats = statsAndInfo.getStats();

      Usage usage = stats.getUsage();
      double cpu = 0.0;
      String memory = "0M"; //$NON-NLS-1$
      String disk = "0M"; //$NON-NLS-1$
      if (usage != null) {
        cpu = usage.getCpu();
        memory = getFormattedMemory(usage.getMem() / 1024);
        disk = getFormattedMemory(usage.getDisk() / 1024);
      }
      switch (columnIndex) {
      case 0:
        return stats.getId();
      case 1:
View Full Code Here

Examples of org.nimbustools.api.repr.Usage

    public UsedAndReservedTime_Type queryUsedAndReservedTime(String callerDN)
            throws ManageException, CannotTranslateException {

        final Caller caller = this.translate.getCaller(callerDN);
        final Usage usage = this.manager.getCallerUsage(caller);
        return this.translate.getUsedAndReserved(usage);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.