Class RefImpl<T>
java.lang.Object
org.apache.jena.sparql.service.enhancer.claimingcache.RefImpl<T>
- All Implemented Interfaces:
AutoCloseable
,Ref<T>
Implementation of a
Ref
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAcquire a new reference with a given comment object Acquiration fails if isAlive() returns falsevoid
close()
static <T> Ref<T>
create
(T value, Object synchronizer, AutoCloseable releaseAction) static <T> Ref<T>
create
(T value, Object synchronizer, AutoCloseable releaseAction, Object comment) static <T> Ref<T>
Create method where the close action is created from a provided lambda that accepts the valuestatic <T> Ref<T>
static <T extends AutoCloseable>
Ref<T>fromCloseable
(T value, Object synchronizer) get()
Get the referent only iff this ref instance has not yet been closed.Optional operation.Optional operation.Optional operation.Get the root referenceReturn the object on which reference acquisition, release and the close action are synchronized on.boolean
isAlive()
A reference may itself be closed, but references to it may keep it aliveboolean
isClosed()
Check whether this reference is closedtoString()
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.jena.sparql.service.enhancer.claimingcache.Ref
acquire, acquireMapped
-
Constructor Details
-
RefImpl
-
-
Method Details
-
getComment
-
getSynchronizer
Description copied from interface:Ref
Return the object on which reference acquisition, release and the close action are synchronized on.- Specified by:
getSynchronizer
in interfaceRef<T>
-
get
Description copied from interface:Ref
Get the referent only iff this ref instance has not yet been closed. This method fails for closed alive refs. A closed reference is alive if it has unclosed child references. For most use cases the referent should be accessed using this method. -
acquire
Description copied from interface:Ref
Acquire a new reference with a given comment object Acquiration fails if isAlive() returns false -
isAlive
public boolean isAlive()Description copied from interface:Ref
A reference may itself be closed, but references to it may keep it alive -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceRef<T>
-
fromCloseable
-
create2
Create method where the close action is created from a provided lambda that accepts the value -
create
-
create
public static <T> Ref<T> create(T value, Object synchronizer, AutoCloseable releaseAction, Object comment) -
createClosed
-
isClosed
public boolean isClosed()Description copied from interface:Ref
Check whether this reference is closed -
getRootRef
Description copied from interface:Ref
Get the root reference- Specified by:
getRootRef
in interfaceRef<T>
-
getAcquisitionStackTrace
Description copied from interface:Ref
Optional operation. References may expose where they were acquired.- Specified by:
getAcquisitionStackTrace
in interfaceRef<T>
-
getCloseStackTrace
Description copied from interface:Ref
Optional operation. References may expose where they were closed was called.- Specified by:
getCloseStackTrace
in interfaceRef<T>
-
getCloseTriggerStackTrace
Description copied from interface:Ref
Optional operation. References may expose where they were close was triggered upon release.- Specified by:
getCloseTriggerStackTrace
in interfaceRef<T>
-
toString
-