Class NoopSharedResource
- java.lang.Object
-
- com.yahoo.jdisc.NoopSharedResource
-
- All Implemented Interfaces:
SharedResource
- Direct Known Subclasses:
NonWorkingClientProvider
,NonWorkingRequestHandler
,NonWorkingServerProvider
public class NoopSharedResource extends java.lang.Object implements SharedResource
An implementation ofSharedResource
that does not do anything. Useful base class for e.g. mocks of SharedResource sub-interfaces, where reference counting is not the focus.- Author:
- bakksjo
-
-
Field Summary
-
Fields inherited from interface com.yahoo.jdisc.SharedResource
DEBUG, SYSTEM_PROPERTY_NAME_DEBUG
-
-
Constructor Summary
Constructors Constructor Description NoopSharedResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceReference
refer()
Increments the reference count of this resource.void
release()
Releases the "main" reference to this resource (the implicit reference due to creation of the object).
-
-
-
Method Detail
-
refer
public final ResourceReference refer()
Description copied from interface:SharedResource
Increments the reference count of this resource. You call this method to prevent an object from being destroyed until you have finished using it.
You MUST keep the returned
ResourceReference
object and release the reference by callingResourceReference.close()
on it. A reference created by this method can NOT be released by callingSharedResource.release()
.- Specified by:
refer
in interfaceSharedResource
- See Also:
ResourceReference.close()
-
release
public final void release()
Description copied from interface:SharedResource
Releases the "main" reference to this resource (the implicit reference due to creation of the object).
References obtained by calling
SharedResource.refer()
must be released by callingResourceReference.close()
on theResourceReference
returned fromSharedResource.refer()
, NOT by calling this method. You call this method once you are done using an object that you have previously caused instantiation of.- Specified by:
release
in interfaceSharedResource
- See Also:
ResourceReference
-
-