Object realValue()

in boot-fx/src/main/java/org/netbeans/html/boot/fx/AbstractFXPresenter.java [559:600]


        Object realValue(JSObject obj) {
            Object java = obj.getMember("fxBrwsrId");
            if (java instanceof JSObject) {
                for (;;) {
                    final int resultHash;
                    final int resultId;
                    final NavigableSet<Ref> refs;
                    synchronized (this) {
                        this.hash = -1;
                        this.id = -1;
                        obj.call("fxBrwsrId", new Object[] { this });
                        assert this.hash != -1;
                        assert this.id != -1;
                        resultHash = this.hash;
                        resultId = this.id;
                        refs = values.get(resultHash);
                        if (refs == null) {
                            return null;
                        }
                    }

                    Iterator<Ref> it = refs.iterator();
                    while (it.hasNext()) {
                        Ref next = it.next();
                        Object[] pojo = { next.value() };
                        if (pojo[0] == null) {
                            it.remove();
                            continue;
                        }
                        if (next.id() == resultId) {
                            return emitJavaObject(pojo, resultHash, resultId);
                        }
                    }
                    if (refs.isEmpty()) {
                        synchronized (this) {
                            values.remove(resultHash);
                        }
                    }
                }
            }
            return obj;
        }