Package org.ow2.asm.commons

Examples of org.ow2.asm.commons.EmptyVisitor


                AbstractInsnNode insn = it.next();
                mn.instructions.set(insn, insn.clone(m));
            }
        }
        // test accept with visitors that remove class members
        cn.accept(new EmptyVisitor() {
            @Override
            public FieldVisitor visitField(
                int access,
                String name,
                String desc,
View Full Code Here


        mv.visitMaxs(maxStack, maxLocals);
        mv.visitEnd();
        cw.visitEnd();
        byte[] b = cw.toByteArray();
        ClassReader cr = new ClassReader(b);
        cr.accept(new EmptyVisitor() {
            @Override
            public MethodVisitor visitMethod(
                final int access,
                final String name,
                final String desc,
                final String signature,
                final String[] exceptions)
            {
                if (name.equals("m")) {
                    return new MethodNode(access,
                            name,
                            desc,
                            signature,
                            exceptions)
                    {
                        @Override
                        public void visitEnd() {
                            Analyzer<BasicValue> a = new Analyzer<BasicValue>(new BasicInterpreter());
                            try {
                                Frame<BasicValue>[] frames = a.analyze("C", this);
                                int mStack = 0;
                                int mLocals = 0;
                                for (int i = 0; i < frames.length; ++i) {
                                    if (frames[i] != null) {
                                        mStack = Math.max(mStack,
                                                frames[i].getStackSize());
                                        mLocals = Math.max(mLocals,
                                                frames[i].getLocals());
                                    }
                                }
                                assertEquals("maxStack", maxStack, mStack);
                                assertEquals("maxLocals", maxLocals, mLocals);
                            } catch (Exception e) {
                                fail(e.getMessage());
                            }
                        }
                    };
                } else {
                    return new EmptyVisitor();
                }
            }
        }, 0);

        try {
View Full Code Here

                    print(tcb.handler);
                    pw.println();
                }
                for (int j = 0; j < mn.instructions.size(); ++j) {
                    AbstractInsnNode in = mn.instructions.get(j);
                    in.accept(new EmptyVisitor() {

                        @Override
                        public void visitFrame(
                            int type,
                            int local,
View Full Code Here

        });
       
        runTestAll("deserialize", "", new RunTest() {
            @Override
            public void test(byte[] bytes, int[] errors) {
                new ClassReader(bytes).accept(new EmptyVisitor(), 0);
            }
        });

        runTest("deserialize", "tree package", new RunTest() {
            @Override
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

                    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

             * Handle the event.
             * @param event The event to handle.
             */
            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()));

View Full Code Here

     * @param methodVisitor the given visitor on which annotation are replayed.
     */
    @Override
    public void replay(final MethodVisitor methodVisitor) {
        // Build a new annotation visitor for the given method
        AnnotationVisitor annotationVisitor = methodVisitor.visitParameterAnnotation(this.index, getName(), getVisible());
        getLogger().debug("AnnotationVisitor annotationVisitor = methodVisitor.visitParameterAnnotation({0}, {1}, {2});",
                Integer.valueOf(this.index), getName(), Boolean.valueOf(getVisible()));

        // Replay
        replayInner(annotationVisitor);

        // End of visit
        annotationVisitor.visitEnd();
        getLogger().debug("annotationVisitor.visitEnd();");
    }
View Full Code Here

            // Enable bindings into the cluster
            try {
                ConfigurationRepository.getServerConfiguration().enableCMI(this.cmiProperties);
            } 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());
                            }
                        }
                    }
                }
                try {
                    this.clusterViewManager.start();
                } catch (Exception e) {
                    this.logger.error("Cannot start the CMI Server", e);
                    throw new EZBComponentException("Cannot start the CMI Server", e);
                }
            }
        }
        // register the listener.
        EZBEventListener eventListener = new CmiEventListener();
View Full Code Here

TOP

Related Classes of org.ow2.asm.commons.EmptyVisitor

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.