Examples of ApplicationEvent


Examples of org.springframework.context.ApplicationEvent

    }
   
    private class Producer implements Callable {
        public Object call() throws Exception {
            for (int i = 0; i < 5; i++) {
                ApplicationEvent produced = new PayloadEvent(this, new String("test-" + i), null);
                BlockingCollectorTest.this.collector.onApplicationEvent(produced);
                ApplicationEvent polled = BlockingCollectorTest.this.exchanger.exchange(produced);
                BlockingCollectorTest.this.assertSame(produced, polled);
            }
            return null;
        }
View Full Code Here

Examples of org.springframework.context.ApplicationEvent

    }
   
    private class Consumer implements Callable {
        public Object call() throws Exception {
            for (int i = 0; i < 5; i++) {
                ApplicationEvent polled = BlockingCollectorTest.this.collector.pollEvent();
                ApplicationEvent produced = BlockingCollectorTest.this.exchanger.exchange(polled);
                BlockingCollectorTest.this.assertSame(polled, produced);
            }
            return null;
        }
View Full Code Here

Examples of org.springframework.context.ApplicationEvent

    }

    public Producer<Exchange> createProducer() throws Exception {
        return new DefaultProducer<Exchange>(this) {
            public void process(Exchange exchange) throws Exception {
                ApplicationEvent event = toApplicationEvent(exchange);
                getApplicationContext().publishEvent(event);
            }
        };
    }
View Full Code Here

Examples of org.springframework.context.ApplicationEvent

    protected LoadBalancer createLoadBalancer() {
        return new TopicLoadBalancer();
    }

    protected ApplicationEvent toApplicationEvent(Exchange exchange) {
        ApplicationEvent event = exchange.getIn().getBody(ApplicationEvent.class);
        if (event == null) {
            event = new CamelEvent(this, exchange);
        }
        return event;
    }
View Full Code Here

Examples of org.springframework.context.ApplicationEvent

    public Producer<Exchange> createProducer() throws Exception {
        ObjectHelper.notNull(getApplicationContext(), "applicationContext");
        return new DefaultProducer<Exchange>(this) {
            public void process(Exchange exchange) throws Exception {
                ApplicationEvent event = toApplicationEvent(exchange);
                getApplicationContext().publishEvent(event);
            }
        };
    }
View Full Code Here

Examples of org.springframework.context.ApplicationEvent

        return new TopicLoadBalancer();
    }

    protected ApplicationEvent toApplicationEvent(Exchange exchange) {
        try {
            ApplicationEvent event = exchange.getIn().getBody(ApplicationEvent.class);
            if (event != null) {
                return event;
            }
        } catch (NoTypeConversionAvailableException ex) {
            // ignore, handled below
View Full Code Here

Examples of org.springframework.context.ApplicationEvent

    }

    public Producer<Exchange> createProducer() throws Exception {
        return new DefaultProducer<Exchange>(this) {
            public void process(Exchange exchange) throws Exception {
                ApplicationEvent event = toApplicationEvent(exchange);
                getApplicationContext().publishEvent(event);
            }
        };
    }
View Full Code Here

Examples of org.springframework.context.ApplicationEvent

    protected LoadBalancer createLoadBalancer() {
        return new TopicLoadBalancer();
    }

    protected ApplicationEvent toApplicationEvent(Exchange exchange) {
        ApplicationEvent event = exchange.getIn().getBody(ApplicationEvent.class);
        if (event == null) {
            event = new CamelEvent(this, exchange);
        }
        return event;
    }
View Full Code Here

Examples of org.springframework.context.ApplicationEvent


  public Object invoke(MethodInvocation invocation) throws Throwable {
    Object retVal = invocation.proceed();

    ApplicationEvent event = (ApplicationEvent)
        this.applicationEventClassConstructor.newInstance(new Object[] {invocation.getThis()});
    this.applicationEventPublisher.publishEvent(event);

    return retVal;
  }
View Full Code Here

Examples of org.springframework.context.ApplicationEvent

  public void testSimpleApplicationEventMulticaster() {
    MockControl ctrl = MockControl.createControl(ApplicationListener.class);
    ApplicationListener listener = (ApplicationListener) ctrl.getMock();

    ApplicationEvent evt = new ContextClosedEvent(new StaticApplicationContext());
    listener.onApplicationEvent(evt);
    ctrl.setMatcher(new EqualsMatcher());

    SimpleApplicationEventMulticaster smc = new SimpleApplicationEventMulticaster();
    smc.addApplicationListener(listener);
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.