@Override
    public T get() {
        // Double-checked locking: try the _volatile_ variable, and if not initialized, try to initialize it.
        if (wrapped == null) synchronized (monitor) {
            // Ensure the factory is called only once, by clearing it once successfully called.
            if (factory != null) wrapped = requireNonNull(factory.get());
            factory = null;

            // If we found the factory, we won the initialization race, and return normally; otherwise
            // if wrapped is non-null, we lost the race, wrapped was set by the winner, and we return; otherwise
            // we tried to initialise because wrapped was cleared by closing this, and we fail.
            if (wrapped == null) throw new IllegalStateException("already closed");
        }
        return wrapped;
    }
Composes the given memoized with a function taking its output as an argument to produce a new Memoized, with the given closer.
vespajlib/src/main/java/com/yahoo/yolean/concurrent/Memoized.java