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