// The access to the elementsRef field should be synchronized private synchronized VBox<FunctionalSet<E2>> getElementsBox() { VBox<FunctionalSet<E2>> box = elementsRef.get(); if (box == null) { box = SoftReferencedVBox.makeNew(this.listHolder, this.attributeName, true); this.elementsRef = new SoftReference<VBox<FunctionalSet<E2>>>(box); } return box; }
public RelationList( E1 listHolder, Relation<E1, E2> relation, String attributeName, boolean allocateOnly) { this.listHolder = listHolder; this.relation = relation; this.attributeName = attributeName; VBox elementsBox = null; if (allocateOnly) { elementsBox = SoftReferencedVBox.makeNew(listHolder, attributeName, allocateOnly); } else { elementsBox = new SoftReferencedVBox<FunctionalSet<E2>>( listHolder, attributeName, DOFunctionalSet.EMPTY); } this.elementsRef = new SoftReference<VBox<FunctionalSet<E2>>>(elementsBox); }