/** * Checks in the context is recorded for asynchronous install * @param context The context to check * @return the asynchronous install status of the thread */ AsynchronousInstallStatus checkInstalled(ControllerContext context) { InterruptibleControllerTask task = executorTasksByContext.get(context); if (task == null) return AsynchronousInstallStatus.NOT_INSTALLING; else if (Thread.currentThread() != task.getThread()) return AsynchronousInstallStatus.OTHER_THREAD; return AsynchronousInstallStatus.IN_PROGRESS; }
try CountDownLatch latch = task.interrupt(); if (latch != null)
/** * Checks whether context should be installed asynchronously, by checking the controller mode and the current thread * @param context The context * @return Whether the context should be installed in the executor */ boolean shouldInstallAsynchronously(ControllerContext context) { if (context.getMode() == ControllerMode.ASYNCHRONOUS) { final InterruptibleControllerTask task = executorTasksByContext.get(context); return task == null || task.getThread() != Thread.currentThread(); } return false; }