Class NoopSharedResource
- All Implemented Interfaces:
SharedResource
- Direct Known Subclasses:
NonWorkingClientProvider
,NonWorkingRequestHandler
,NonWorkingServerProvider
SharedResource
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.yahoo.jdisc.SharedResource
SharedResource.Debug
-
Field Summary
Fields inherited from interface com.yahoo.jdisc.SharedResource
DEBUG, SYSTEM_PROPERTY_NAME_DEBUG
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal ResourceReference
refer()
Creates a reference to this resource.final ResourceReference
Creates a reference to this resource.final void
release()
Releases the "main" reference to this resource (the implicit reference due to creation of the object).
-
Constructor Details
-
NoopSharedResource
public NoopSharedResource()
-
-
Method Details
-
refer
Description copied from interface:SharedResource
Creates a reference to 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:
-
refer
Description copied from interface:SharedResource
Creates a reference to this resource. You call this method to prevent an object from being destroyed until you have finished using it. You can attach a context that will live as long as the reference.
- Specified by:
refer
in interfaceSharedResource
- Parameters:
context
- A context to be associated with the reference. It should give some clue as to who referenced 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()
.- See Also:
-
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:
-