Code example for ReentrantLock

Methods: lock, newCondition, unlock

0
                run.run();
            } catch (Exception e) {
                throw new ExecutionException(e);
            } 
        } else { 
            final Lock lock = new ReentrantLock();
            final Condition condition = lock.newCondition();
            final ThrowableWrapper throwableWrapper = new ThrowableWrapper();
            lock.lock();
            try { 
                Platform.runLater(new Runnable() {
  
                    @Override 
                    public void run() { 
                        lock.lock();
                        try { 
                            run.run();
                        } catch (Throwable e) {
                            throwableWrapper.t = e;
                        } finally { 
                            try { 
                                condition.signal();
                            } finally { 
                                lock.unlock();
                            } 
                        } 
                    } 
                }); 
                condition.await();
                if (throwableWrapper.t != null) {
                    throw new ExecutionException(throwableWrapper.t);
                } 
            } finally { 
                lock.unlock();
            } 
        } 
    } 
     
    /**