Asynchronous Request Handling

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Asynchronous Request Handling

366388

Hi,

im trying to give the new async stuff a whirl.

I thought I might be able to use it in the following controller methods where I have 2 hql methods (one to get results and the other to get the row count). As these are not dependent on either other I thought it would be a perfect candidate for this ? or maybe not ?



original code:

Set<CategoryItem> administeredItems = userService.getCategoryItemsAdministeredByUser(springSecurityService.getAuthentication().getPrincipal().userId)

...
..

def results = ItemNotification.findAll(hql+order, filters, params )
               
def count = ItemNotification.executeQuery("select count(i.id)  "+hql, filters ) //returns a list
               
render(view:"list", model:[administeredItems: administeredItems, itemNotifications: results, itemNotificationCount: count[0]])




//new code i tried

Set<CategoryItem> administeredItems = userService.getCategoryItemsAdministeredByUser(springSecurityService.getAuthentication().getPrincipal().userId)

..
..

render view:"list", model: tasks( itemNotifications:{ ItemNotification.async.findAll(hql+order, filters, params ) },
                                       itemNotificationCount:{ ItemNotification.async.executeQuery("select count(i.id)  "+hql, filters ) },
                                        administeredItems:{administeredItems})


when I run it there are no exceptions and it just displays the error.gsp page