All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.python.core.PySystemStateRef Maven / Gradle / Ivy

Go to download

Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

The newest version!
package org.python.core;

import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;

/**
 * A weak reference that allows to keep track of PySystemState
 * within Jython core runtime without leaking: as soon as it
 * gets garbage collected, we can clear the places where we have
 * associated data stored.
 */
public class PySystemStateRef extends WeakReference {
    static final ReferenceQueue referenceQueue = new ReferenceQueue<>();
    private ThreadState threadStateBackReference;

    public PySystemStateRef(PySystemState referent, ThreadState threadState) {
        super(referent, referenceQueue);
        threadStateBackReference = threadState;
    }

    public ThreadState getThreadState() {
        return threadStateBackReference;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy