Search in sources :

Example 1 with RxHomeController

use of com.tvd12.example.reactive.RxHomeController in project java-examples by tvd12.

the class ReactiveExample method main.

public static void main(String[] args) {
    final EzyBeanContext beanContext = EzyBeanContext.builder().scan("com.tvd12.example.reactive").build();
    final RxHomeController rxHomeController = (RxHomeController) beanContext.getBean(RxHomeController.class);
    final HomeData rxHomeData = rxHomeController.getHomeData();
    System.out.println("rxHomeData: " + rxHomeData);
}
Also used : HomeData(com.tvd12.example.reactive.data.HomeData) EzyBeanContext(com.tvd12.ezyfox.bean.EzyBeanContext)

Example 2 with RxHomeController

use of com.tvd12.example.reactive.RxHomeController in project java-examples by tvd12.

the class PerformanceCompareTest method main.

public static void main(String[] args) {
    final EzyBeanContext beanContext = EzyBeanContext.builder().scan("com.tvd12.example.reactive").build();
    final HomeController sequenceHomeController = (HomeController) beanContext.getBean(HomeController.class);
    final RxHomeController rxHomeController = (RxHomeController) beanContext.getBean(RxHomeController.class);
    // warm up
    sequenceHomeController.getHomeData();
    rxHomeController.getHomeData();
    long sequenceCallElapsedTime = Performance.create().loop(100000).test(sequenceHomeController::getHomeData).getTime();
    long rxCallElapsedTime = Performance.create().loop(100000).test(rxHomeController::getHomeData).getTime();
    System.out.printf("sequence call elapsed time: %d\nreactive call elapsed time: %d\n", sequenceCallElapsedTime, rxCallElapsedTime);
    Reactive.destroy();
}
Also used : RxHomeController(com.tvd12.example.reactive.RxHomeController) EzyBeanContext(com.tvd12.ezyfox.bean.EzyBeanContext) RxHomeController(com.tvd12.example.reactive.RxHomeController) HomeController(com.tvd12.example.reactive.HomeController)

Aggregations

EzyBeanContext (com.tvd12.ezyfox.bean.EzyBeanContext)2 HomeController (com.tvd12.example.reactive.HomeController)1 RxHomeController (com.tvd12.example.reactive.RxHomeController)1 HomeData (com.tvd12.example.reactive.data.HomeData)1