public class DisposablePyObjectAdapter
extends java.lang.Object
implements org.python.core.adapter.PyObjectAdapter
Py.getAdapter()
in a way that can prevent leaking the module's classloader. The module wraps up their
object adapter in this wrapper, and ensures to call dispose()
when the module is shut down.
This will still cause a memory leak, albeit extremely small: one adapter object per module (re-)start. This is the
only way to be able to use this part of the Jython API because they don't provide for removing adapters that have
been registered.Constructor and Description |
---|
DisposablePyObjectAdapter(org.python.core.adapter.PyObjectAdapter delegate) |
Modifier and Type | Method and Description |
---|---|
org.python.core.PyObject |
adapt(java.lang.Object o) |
boolean |
canAdapt(java.lang.Object o) |
void |
dispose() |
public DisposablePyObjectAdapter(org.python.core.adapter.PyObjectAdapter delegate)
public void dispose()
public boolean canAdapt(java.lang.Object o)
canAdapt
in interface org.python.core.adapter.PyObjectAdapter
public org.python.core.PyObject adapt(java.lang.Object o)
adapt
in interface org.python.core.adapter.PyObjectAdapter