Package org.python.modules._weakref
Class GlobalRef
- All Implemented Interfaces:
ReferenceBackend
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic ReferenceBackendFactoryThis is a hook for JyNI to insert a native-objects-aware implementation of ReferenceBackend. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(AbstractReference ref) intcount()booleanAllowGlobalRefs to be used as hashtable-keys.Search for a reusable reference.static intReturn the number of references to the specifiedPyObject.static PyListReturn a list of references to the specifiedPyObject.static booleaninthashCode()AllowsGlobalRefto be used as hashtable-keys.booleanstatic ReferenceBackendnewInstance(PyObject object) Create a new trackedReferenceBackend.static voidCall all callbacks that were enqueued viadelayedCallback(GlobalRef)method.intThe publicly usedhashCode, for theAbstractReferencewrapper.refs()voidRestores this weak reference to its former referent.Methods inherited from class java.lang.ref.Reference
clear, enqueue, get, isEnqueued, reachabilityFence, refersToMethods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.python.modules._weakref.ReferenceBackend
get
-
Field Details
-
factory
This is a hook for JyNI to insert a native-objects-aware implementation of ReferenceBackend.
-
-
Constructor Details
-
GlobalRef
-
-
Method Details
-
add
- Specified by:
addin interfaceReferenceBackend
-
find
Search for a reusable reference. To be reused, it must be of the same class and it must not have a callback.- Specified by:
findin interfaceReferenceBackend
-
processDelayedCallbacks
public static void processDelayedCallbacks()Call all callbacks that were enqueued viadelayedCallback(GlobalRef)method.- See Also:
-
hasDelayedCallbacks
public static boolean hasDelayedCallbacks() -
isCleared
public boolean isCleared()- Specified by:
isClearedin interfaceReferenceBackend
-
count
public int count()- Specified by:
countin interfaceReferenceBackend
-
refs
- Specified by:
refsin interfaceReferenceBackend
-
newInstance
Create a new trackedReferenceBackend. If noReferenceBackendFactoryis registered, it actually returns aGlobalRef.- Parameters:
object- aPyObjectto reference- Returns:
- a new tracked
ReferenceBackend
-
restore
Restores this weak reference to its former referent. This actually means that a freshGlobalRefis created and inserted into all adjacentAbstractReferences. The currentGlobalRefis disbanded. If the givenPyObjectis not the former referent of this weak reference, anIllegalArgumentExceptionis thrown.- Specified by:
restorein interfaceReferenceBackend- Throws:
IllegalArgumentException- ifformerReferentis not the actual former referent.
-
getCount
Return the number of references to the specifiedPyObject.- Parameters:
object- a PyObject- Returns:
- an int reference count
-
getRefs
Return a list of references to the specifiedPyObject. -
equals
AllowGlobalRefs to be used as hashtable-keys. -
hashCode
public int hashCode()AllowsGlobalRefto be used as hashtable-keys. -
pythonHashCode
public int pythonHashCode()The publicly usedhashCode, for theAbstractReferencewrapper.- Specified by:
pythonHashCodein interfaceReferenceBackend- Returns:
- a hashCode
int-value
-