Package com.yahoo.jdisc
Interface ResourceReference
- All Superinterfaces:
AutoCloseable
Represents a live reference to a SharedResource
. Only provides the ability to release the reference.
Implements AutoCloseable
so that it can be used in try-with-resources statements. Example
void doSomethingWithRequest(Request request) { try (ResourceReference ref = request.refer()) { // Do something with request } // ref.close() will be called automatically on exit from the try block, releasing the reference on 'request'. }
- Author:
- bakksjo
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Decrements the reference count of the referenced resource.
-
Method Details
-
close
void close()Decrements the reference count of the referenced resource. You call this method once you are done using an object that you have previously
referred
.Note that this method is NOT idempotent; you must call it exactly once.
- Specified by:
close
in interfaceAutoCloseable
- See Also:
-