public static ResourceReference fromResource(SharedResource resource) {
        return resource::release;
    }
<p>Returns a {@link ResourceReference} that invokes {@link SharedResource#release()} on
{@link ResourceReference#close() close}. Useful for treating the "main" reference of a {@link SharedResource}
just as any other reference obtained by calling {@link SharedResource#refer()}. Example:</p>
<pre>
    Request request = new Request(...);
    try (ResourceReference ref = References.fromResource(request)) {
        ....
    }
    // The request will be released on exit from the try block.
</pre>

@param resource The resource to create a ResourceReference for.
@return a ResourceReference whose close() method will call release() on the given resource.
jdisc_core/src/main/java/com/yahoo/jdisc/References.java