Errai: The browser as a platform

Monday, January 14, 2013

Timing your methods!

Errai 3.0 development continues to move forward unabated. One new feature that I worked on today is something I've being pining for recently.

When you're developing rich web apps, one thing you often find yourself working with are timers. 

They enable animations and timeout logic in your application logic. But since Errai manages beans inside your browser, it seemed like an elegant solution that fits in nicely with other beany features was in order. 

Enter, the @Timed annotation!

This example shows a method that is part of a bean, which we have annotated with the @Timed annotation. In this case we have configured the timer to fire every one second.

You get all the benefits of working in a managed bean environment. For instance, when the bean is destroyed, so to is the timer, implicitly.

Anyways, this just went directly into the Errai 3.0 branch, and if you want to play with it, get forking!

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I was happy to attend your Errai & CDI session in JUDCON 2013 today in Bangalore.
    You were pretty impressive, 3 back to back sessions one after other without break. Wow you have good stamina.

    I want to know, How exactly Errai uses push mechanism to communicate data?
    1. Won't it be an over head on the server side ?
    2. Until when will the server keep contact with the client?
    3. Will there be continuous communication between server & client. Wont it be network overhead.
    4. Is it suitable for all kind of traffic ? or suitable for servers which are having less traffic(client access) ?

    Regards,
    Sandy

    ReplyDelete