code: private void reinitializeIfNecessary() {
          if (this.resourceCache == null || this.resourceCache.size() > 0) {
              this.resourcesGraph = new ListenableDirectedGraph<>(DefaultEdge.class);
              this.neighborIndex = new DirectedNeighborIndex<>(this.resourcesGraph);
              this.resourcesGraph.addGraphListener(neighborIndex);
              this.resourceCache = new HashMap<>();
              this.resourcesGraph.addVertexSetListener(new VertexCacheListener());
          }
      }
docs: Always call with {@link #graphLockWrite} locked.