Examples of fireAsyncEvent()


Examples of net.hasor.core.EventContext.fireAsyncEvent()

        ec.addListener(SeedEvent, new EventListener() {
            public void onEvent(String event, Object[] params) throws Throwable {
                AppContext app = (AppContext) params[0];
                EventContext localEC = app.getEnvironment().getEventContext();
                System.out.println("before MyEvent.");
                localEC.fireAsyncEvent(EventName, 1);
                localEC.fireAsyncEvent(EventName, 2);
            }
        });
        //2.引发种子事件
        ec.fireAsyncEvent(SeedEvent, appContext);
View Full Code Here

Examples of net.hasor.core.EventContext.fireAsyncEvent()

            public void onEvent(String event, Object[] params) throws Throwable {
                AppContext app = (AppContext) params[0];
                EventContext localEC = app.getEnvironment().getEventContext();
                System.out.println("before MyEvent.");
                localEC.fireAsyncEvent(EventName, 1);
                localEC.fireAsyncEvent(EventName, 2);
            }
        });
        //2.引发种子事件
        ec.fireAsyncEvent(SeedEvent, appContext);
        //3.由于是同步事件,因此下面这条日志会在事件处理完毕之后喷出
View Full Code Here

Examples of net.hasor.core.EventContext.fireAsyncEvent()

        String EventName = "MyEvent";
        //1.添加事件监听器
        ec.addListener(EventName, new MyListener());
        //2.引发异步事件
        for (int i = 0; i < 10; i++)
            ec.fireAsyncEvent(EventName, i);
        //3.由于是异步事件,因此下面这条日志会在事件喷出Log之前打印
        System.out.println("before Event do sth...");
        //
        Thread.sleep(5000);
    }
View Full Code Here

Examples of net.hasor.core.EventContext.fireAsyncEvent()

        String EventName = "MyEvent";
        //1.添加事件监听器
        ec.pushListener(EventName, new MyListener());
        //2.引发异步事件,虽然引发了10次事件但只有一次会被执行。
        for (int i = 0; i < 10; i++)
            ec.fireAsyncEvent(EventName, i);
        //3.由于事件引发一次是同步事件,因此下面这条日志会在事件处理完毕之后喷出
        System.out.println("before Event do sth...");
        //
        Thread.sleep(5000);
    }
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.