Making sure a block of code is executed outside the UIThread is made by invoking the execOutsideUI{} method. This method is equivalent to calling doOutside{} in Swing.

Example:

class MyController {
    def model

def action1 = { // will be invoked inside the UI Thread by default (pre 0.9.2) def value = model.value execOutsideUI { // do some calculations execInsideUIAsync { // back inside the UI Thread model.result = … } } }

def action2 = { // will be invoked outside of the UI Thread by default (post 0.9.2) def value = model.value // do some calculations execInsideUIAsync { // back inside the UI Thread model.result = … execOutsideUI { // do more calculations } } } }