Play! touts is its asynchronous HTTP processing function, although it’s not very clear to me what is really asynchronous (without blocking and without switching threads.) In the asynchronous examples I read, like the game below! Framework cookbook:
public static void generateInvoice(Long orderId) { Order order = Order.findById(orderId);
They focus on the long / expensive “business logic” step on #b, but I'm worried about DB calls on #a. In fact, most controller methods in many applications will simply try to do some CRUD for DB, for example:
public static void generateInvoice(Long orderId) { Order order = Order.findById(orderId);
I am particularly concerned about the requirement to use a "small number of threads" when serving a database access pattern.
So the questions are:
- Will play! will block JDBC calls?
- If we complete such calls in the future / promise / expect, this will cause thread switching (besides the inconvenience due to the ubiquity of database calls), right?
- In light of this, how is its asynchronism compared to a servlet server with an NIO connector (for example, Tomcat + NIO connector, but without using a new event handler) in servicing this database access pattern?
- Is there any plan to support the asynchronous DB driver, for example http://code.google.com/p/adbcj/ ?
source share