isUIThread()

Purpose

Helper method to find out if the current thread is the UI thread or not.

Examples

class SampleController {
    private longRunningCode() {
        if(isUIThread()) {
            throw new RuntimeException('Must NOT be called inside the UI Thread')
        }
    }
}

Description

See the threading section for more information about this method and others like it.