presto-main/src/main/java/io/prestosql/operator/PagesSpatialIndexFactory.java/PagesSpatialIndexFactory/lendPagesSpatialIndex
class PagesSpatialIndexFactory:    public ListenableFuture<?> lendPagesSpatialIndex(Supplier<PagesSpatialIndex> pagesSpatialIndex)
    {
        requireNonNull(pagesSpatialIndex, "pagesSpatialIndex is null");

        List<SettableFuture<PagesSpatialIndex>> settableFutures;
        synchronized (this) {
            if (destroyed.isDone()) {
                return destroyed;
            }

            verify(this.pagesSpatialIndex == null);
            this.pagesSpatialIndex = pagesSpatialIndex;
            settableFutures = ImmutableList.copyOf(pagesSpatialIndexFutures);
            pagesSpatialIndexFutures.clear();
        }

        for (SettableFuture<PagesSpatialIndex> settableFuture : settableFutures) {
            settableFuture.set(pagesSpatialIndex.get());
        }

        return destroyed;
    }