if (monitor != null) {
// Thread watching user cancellation requests
new Thread(new Runnable() {
@Override public void run() {
IFn realized = Clojure.var("clojure.core", "realized?");
while (true) {
if ((Boolean) realized.invoke(replURLPromise)) {
// repl promise has been delivered
return;
}
if (getResult() != null) {
// Job has finished
return;
}
if (monitor.isCanceled()) {
IFn deliver = Clojure.var("clojure.core", "deliver");
deliver.invoke(replURLPromise, cancelObject);
return;
}
try {
Thread.sleep(100);
} catch (InterruptedException e) {
CCWPlugin.logError("Error in the thread monitoring user cancellation for REPL launch of " + launchName, e);
return;
}
}
}}).start();
}
IFn deref = Clojure.var("clojure.core", "deref");
Object timeOutObject = new Object();
Object replURL = (Object) deref.invoke(replURLPromise, REPL_START_TIMEOUT_MS, timeOutObject);
if (replURL == timeOutObject) {
CCWPlugin.logError("Waiting for new REPL process ack timed out");
return CCWPlugin.createErrorStatus("Waiting for new REPL process ack timed out");
} else if (replURL == cancelObject) {