Package org.ow2.asm.util

Examples of org.ow2.asm.util.TraceMethodVisitor


                                         final String desc,
                                         final String signature,
                                         final String[] exceptions) {

            if ( this.methodName.equals( name ) ) {
                this.trace = new TraceMethodVisitor();
                return this.trace;
            }
            return null;
        }
View Full Code Here


    public List getMethodBytecode(final String methodName,
                                  final ClassReader classReader) {
        final Tracer visit = new Tracer( methodName );
        classReader.accept( visit,
                            ClassReader.SKIP_DEBUG );
        final TraceMethodVisitor trace = visit.getTrace();
        return trace.getText();
    }
View Full Code Here

                                         final byte[] bytes) {
        final Tracer visit = new Tracer( methodName );
        final ClassReader classReader = new ClassReader( bytes );
        classReader.accept( visit,
                            ClassReader.SKIP_DEBUG );
        final TraceMethodVisitor trace = visit.getTrace();
        return trace.getText();
    }
View Full Code Here

        super.setUp();
        jsr = new JSRInlinerAdapter(null, 0, "m", "()V", null, null) {
            @Override
            public void visitEnd() {
                System.err.println("started w/ method:" + name);
                TraceMethodVisitor mv = new TraceMethodVisitor();
                for (int i = 0; i < instructions.size(); ++i) {
                    instructions.get(i).accept(mv);
                    System.err.print(Integer.toString(i + 100000).substring(1));
                    System.err.print(" : " + mv.text.get(i));
                }
View Full Code Here

        System.err.println("Actual=" + textact);
        assertEquals(textexp, textact);
    }

    private String getText(final MethodNode mn) {
        TraceMethodVisitor tmv = new TraceMethodVisitor(null);
        mn.accept(tmv);

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < tmv.text.size(); i++) {
            sb.append(tmv.text.get(i));
View Full Code Here

                        a.analyze(cn.name, method);
                    } catch (Exception ignored) {
                    }
                    final Frame<?>[] frames = a.getFrames();

                    TraceMethodVisitor mv = new TraceMethodVisitor() {
                        @Override
                        public void visitMaxs(
                            final int maxStack,
                            final int maxLocals)
                        {
                            for (int i = 0; i < text.size(); ++i) {
                                StringBuffer s = new StringBuffer(frames[i] == null
                                        ? "null"
                                        : frames[i].toString());
                                while (s.length() < Math.max(20, maxStack
                                        + maxLocals + 1))
                                {
                                    s.append(' ');
                                }
                                System.err.print(Integer.toString(i + 1000)
                                        .substring(1)
                                        + " " + s + " : " + text.get(i));
                            }
                            System.err.println();
                        }
                    };
                    for (int j = 0; j < method.instructions.size(); ++j) {
                        Object insn = method.instructions.get(j);
                        ((AbstractInsnNode) insn).accept(mv);
                    }
                    mv.visitMaxs(0, 0);
                }
            }
        }
    }
View Full Code Here

            } catch (Exception e) {
                this.logger.error("Cannot configure Carol to use CMI", e);
                throw new EZBComponentException("Cannot configure Carol to use CMI", e);
            }

            ClusterViewManagerFactory clusterViewManagerFactory = ClusterViewManagerFactory.getFactory();

            // Start the manager
            try {
                this.clusterViewManager = (ServerClusterViewManager) clusterViewManagerFactory.create();
            } catch (Exception e) {
                this.logger.error("Cannot retrieve the CMI Server", e);
                throw new EZBComponentException("Cannot retrieve the CMI Server", e);
            }
            if (this.clusterViewManager != null
                    && this.clusterViewManager.getState().equals(ClusterViewManager.State.STOPPED)) {
                if (this.eventComponent != null) {
                    List<Component> components =
                        clusterViewManagerFactory.getConfig().getComponents().getComponents();
                    if (components != null) {
                        for (Component cmiEventComponent : components) {
                            if (org.ow2.cmi.component.event.EventComponent.class.isAssignableFrom(cmiEventComponent.getClass())) {
                                ((org.ow2.cmi.component.event.EventComponent) cmiEventComponent).setEventService(
                                        this.eventComponent.getEventService());
View Full Code Here

            return EASYBEANS_ROOT;
        } else if (EZBContainer.class.isAssignableFrom(clazz)) {
            // The object is an EJB container.

            EZBContainer container = (EZBContainer) instance;

            // Get the archive name (remove all character before the last slash/antislash).
            String archiveName = container.getName().replaceAll("(.*[/\\\\])", "");

            // Compute the application id.
            return EASYBEANS_ROOT + "/" + container.getApplicationName() + "/" + archiveName;
        } else if (Factory.class.isAssignableFrom(clazz)) {
            // The object is a bean factory.

            Factory<?, ?> factory = (Factory<?, ?>) instance;
            EZBContainer container = factory.getContainer();

            // Get the archive name (remove all character before the last slash/antislash).
            String archiveName = container.getName().replaceAll("(.*[/\\\\])", "");

            // Get the bean class name (remove all character before the last point).
            String factoryName = factory.getClassName().replaceAll("(.*\\.)", "");

            // Compute the bean id.
            return EASYBEANS_ROOT + "/" + container.getApplicationName() + "/" + archiveName + "/" + factoryName;
        } else {
            throw new java.lang.IllegalArgumentException("Name is not define for argument of type " + instance.getClass());
        }
    }
View Full Code Here

                    throw new EZBComponentException("Cannot start the CMI Server", e);
                }
            }
        }
        // register the listener.
        EZBEventListener eventListener = new CmiEventListener();
        this.eventComponent.registerEventListener(eventListener);

        this.logger.debug("The CMI configuration extension has been added.");
    }
View Full Code Here

            public synchronized void handle(final IEvent event) {
                if (EZBEventBeanInvocationBegin.class.isAssignableFrom(event.getClass())) {
                    EZBEventBeanInvocationBegin e = (EZBEventBeanInvocationBegin) event;
                    MeanCallTimeStatistic.this.pendingCall.put(Long.valueOf(e.getInvocationNumber()), e);
                } else {
                    EZBEventBeanInvocation eventEnd = (EZBEventBeanInvocation) event;
                    EZBEventBeanInvocation eventBegin =
                        MeanCallTimeStatistic.this.pendingCall.remove(Long.valueOf(eventEnd.getInvocationNumber()));

                    MeanCallTimeStatistic.this.count++;
                    MeanCallTimeStatistic.this.total += eventEnd.getTime() - eventBegin.getTime();
                    setLastSampleTime(System.currentTimeMillis());
                }
            }
View Full Code Here

TOP

Related Classes of org.ow2.asm.util.TraceMethodVisitor

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.