Package org.jvnet.hk2.tracing

Examples of org.jvnet.hk2.tracing.InhabitantTracing


        return deployed;
    }

    private static boolean isUpgrade(String resource, EjbTimerService _ejbt, File root) {
        boolean upgrade = false;
        Property prop = null;
        if (_ejbt != null) {
            List<Property> properties = _ejbt.getProperty();
            if (properties != null) {
                for (Property p : properties) {
                    if (p.getName().equals(EjbContainerUtil.TIMER_SERVICE_UPGRADED)) {
View Full Code Here


            String attr = null;
            String val = null;
            try {
                if (parser.next() == START_ELEMENT) {
                    if (parser.getLocalName().equals("property") && ar != null) {
                        Property p = ar.createChild(Property.class);
                        ar.getProperty().add(p);
                        createProperty(p);
                    }
                }
            } catch (TransactionFailure ex) {
View Full Code Here

            String attr = null;
            String val = null;
            try {
                if (parser.next() == START_ELEMENT) {
                    if (parser.getLocalName().equals("property") && jp != null) {
                        Property p = jp.createChild(Property.class);
                        jp.getProperty().add(p);
                        for (int i = 0; i < parser.getAttributeCount(); i++) {
                            attr = parser.getAttributeLocalName(i);
                            val = parser.getAttributeValue(i);
                            if (attr.equals("name")) {
                                p.setName(val);
                            }
                            if (attr.equals("value")) {
                                p.setValue(val);
                            }
                        }
                    }
                }
            } catch (TransactionFailure ex) {
View Full Code Here

    private void createAuditModuleProperty(AuditModule am) throws PropertyVetoException {
        while (!(parser.getEventType() == END_ELEMENT && parser.getLocalName().equals("audit-module"))) {
            try {
                if (parser.next() == START_ELEMENT) {
                    if (parser.getLocalName().equals("property") && am != null) {
                        Property p = am.createChild(Property.class);
                        am.getProperty().add(p);
                        createProperty(p);
                    }
                }
            } catch (TransactionFailure ex) {
View Full Code Here

    private void createProviderConfigProperty(ProviderConfig pc) throws PropertyVetoException {
        while (!(parser.getEventType() == END_ELEMENT && parser.getLocalName().equals("provider-config"))) {
            try {
                if (parser.next() == START_ELEMENT) {
                    if (parser.getLocalName().equals("property") && pc != null) {
                        Property p = pc.createChild(Property.class);
                        pc.getProperty().add(p);
                        createProperty(p);
                    }
                }
            } catch (TransactionFailure ex) {
View Full Code Here

                new DefaultClassAnalyzer(sli)));

        dci.commit();

        GuiceBridge.getGuiceBridge().initializeGuiceBridge(sli);
        GuiceIntoHK2Bridge guiceBridge = sli.getService(GuiceIntoHK2Bridge.class);
        guiceBridge.bridgeGuiceInjector(GuiceInjectorHolder.getInjector());

        return sli;
    }
View Full Code Here

                in(Singleton.class.getName()).
                localOnly().
                build());

        dci.bind(BuilderHelper.createConstantDescriptor(
                new DefaultClassAnalyzer(sli)));

        dci.commit();

        GuiceBridge.getGuiceBridge().initializeGuiceBridge(sli);
        GuiceIntoHK2Bridge guiceBridge = sli.getService(GuiceIntoHK2Bridge.class);
View Full Code Here

            throw new AssertionError("parent must be a " + ServiceLocatorImpl.class.getName() +
                    " instead it is a " + parent.getClass().getName());
        }

        final ServiceLocatorImpl sli = new ServiceLocatorImpl(name, (ServiceLocatorImpl) parent);
        final DynamicConfigurationImpl dci = new DynamicConfigurationImpl(sli);

        // The service locator itself
        dci.bind(Utilities.getLocatorDescriptor(sli));

        // The injection resolver for three thirty
        dci.addActiveDescriptor(Utilities.getThreeThirtyDescriptor(sli));

        // The dynamic configuration utility
        dci.bind(BuilderHelper.link(DynamicConfigurationServiceImpl.class, false).
                to(DynamicConfigurationService.class).
                in(Singleton.class.getName()).
                localOnly().
                build());

        dci.bind(BuilderHelper.createConstantDescriptor(
                new DefaultClassAnalyzer(sli)));

        dci.commit();

        GuiceBridge.getGuiceBridge().initializeGuiceBridge(sli);
        GuiceIntoHK2Bridge guiceBridge = sli.getService(GuiceIntoHK2Bridge.class);
        guiceBridge.bridgeGuiceInjector(GuiceInjectorHolder.getInjector());
View Full Code Here

        if (parent != null && !(parent instanceof ServiceLocatorImpl)) {
            throw new AssertionError("parent must be a " + ServiceLocatorImpl.class.getName() +
                    " instead it is a " + parent.getClass().getName());
        }

        final ServiceLocatorImpl sli = new ServiceLocatorImpl(name, (ServiceLocatorImpl) parent);
        final DynamicConfigurationImpl dci = new DynamicConfigurationImpl(sli);

        // The service locator itself
        dci.bind(Utilities.getLocatorDescriptor(sli));

        // The injection resolver for three thirty
        dci.addActiveDescriptor(Utilities.getThreeThirtyDescriptor(sli));

        // The dynamic configuration utility
        dci.bind(BuilderHelper.link(DynamicConfigurationServiceImpl.class, false).
                to(DynamicConfigurationService.class).
                in(Singleton.class.getName()).
                localOnly().
                build());

        dci.bind(BuilderHelper.createConstantDescriptor(
                new DefaultClassAnalyzer(sli)));

        dci.commit();

        GuiceBridge.getGuiceBridge().initializeGuiceBridge(sli);
        GuiceIntoHK2Bridge guiceBridge = sli.getService(GuiceIntoHK2Bridge.class);
        guiceBridge.bridgeGuiceInjector(GuiceInjectorHolder.getInjector());

        return sli;
    }
View Full Code Here

            w = new FileWriter(out);
            w.append("\n");
            w.append("Module ["+ bundleId + "] " + state + " " + bundleName+"\n");
            String prefix="-";
            StackTraceElement[] stack = Thread.currentThread().getStackTrace();
            InhabitantTracing tracing = TracingThreadLocal.get();
            Iterator<Inhabitant> itr = tracing.inOrder();

            w.append("\n");
            w.append("-----------------------------------\n");
            w.append("Inhabitants / stack combination\n");
            w.append("-----------------------------------\n");

            String currentBundleName = bundleName;
           
            for (int i=0;i<stack.length;i++) {
                StackTraceElement element = stack[i];
                if (element.getClassName().equals(AbstractInhabitantImpl.class.getName()) &&
                        element.getMethodName().equals("get"))  {
                    // now let's find out the first non hk2 class asking for this...
                    int j=i+1;
                    for (;j<stack.length;j++) {
                        StackTraceElement caller = stack[j];
                        if (!caller.getClassName().contains("hk2")) {
                            break;
                        }
                    }
                    if (itr.hasNext()) {
                        Inhabitant reason = itr.next();
                        StackTraceElement caller = stack[j];
                        Module m = null;
                        try {
                            if (reason.isInstantiated()) {
                                m = registry.find(loader.loadClass(reason.typeName()));
                            }
                        } catch (ClassNotFoundException e) {
                            m = null;
                        }
                        if (m!=null && !m.getModuleDefinition().getName().equals(currentBundleName)) {
                            w.append("Looks like module " + currentBundleName + " was " + state + " because "+
                                    m.getName() + " was " + state + "\nSince " + m.getName() + " contains ");
                        } else {
                            w.append("Requested by ");
                        }
                        if (m!=null)
                            currentBundleName = m.getName();

                        w.append(reason + " called from " + caller.getClassName()
                                + "." + caller.getMethodName() + ":" + caller.getLineNumber()+" metadata \n" + reason.metadata()+"\n");
                        w.append("\n");

                    }

                }

            }
            w.append("\n");

            w.append("-----------------------------------\n");
            w.append("Inhabitants initialization stack\n");
            w.append("-----------------------------------\n");
            itr = tracing.inOrder();
            while (itr.hasNext()) {
                Inhabitant i = itr.next();
                w.append(prefix +"> requested from "+ i+"\n");
                prefix=prefix+"-";
            }
View Full Code Here

TOP

Related Classes of org.jvnet.hk2.tracing.InhabitantTracing

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.