@Override public void interrupted() { if (performed) { return; } performed = true; if (timerId >= 0) { Platform.killSchedule(timerId); timerId = -1; } Platform.postpone(() -> callback.error(new TInterruptedException())); }
static void monitorEnterWait( final TObject o, final int count, final AsyncCallback<Void> callback) { final TThread thread = TThread.currentThread(); if (o.monitor == null) { o.monitor = new Monitor(); TThread.setCurrentThread(thread); o.monitor.count += count; callback.complete(null); return; } else if (o.monitor.owner == null) { o.monitor.owner = thread; TThread.setCurrentThread(thread); o.monitor.count += count; callback.complete(null); return; } o.monitor.enteringThreads.add( () -> { TThread.setCurrentThread(thread); o.monitor.owner = thread; o.monitor.count += count; callback.complete(null); }); }