From 2d6bf4bcb17fa37a8e4725c242d9f9cfd3018f12 Mon Sep 17 00:00:00 2001 From: Jianfeng Mao <4297243+jmao-denver@users.noreply.github.com> Date: Fri, 5 Jul 2024 18:30:54 -0600 Subject: [PATCH] fix: make TableListenerHandle a JObjectWrapper again (#5713) So that it can be directly added to LivenessScope Fixes #5711 --- py/server/deephaven/table_listener.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/py/server/deephaven/table_listener.py b/py/server/deephaven/table_listener.py index d07162a07ad..624132b29b0 100644 --- a/py/server/deephaven/table_listener.py +++ b/py/server/deephaven/table_listener.py @@ -308,8 +308,9 @@ def _wrap_listener_obj(t: Table, listener: TableListener): return listener -class TableListenerHandle: +class TableListenerHandle(JObjectWrapper): """A handle to manage a table listener's lifecycle.""" + j_object_type = _JPythonReplayListenerAdapter def __init__(self, t: Table, listener: Union[Callable, TableListener], description: str = None, dependencies: Union[Table, Sequence[Table]] = None): @@ -364,6 +365,10 @@ def __init__(self, t: Table, listener: Union[Callable, TableListener], descripti raise DHError(e, "failed to create a table listener.") from e self.started = False + @property + def j_object(self) -> jpy.JType: + return self.listener + def start(self, do_replay: bool = False, replay_lock: Literal["shared", "exclusive"] = "shared") -> None: """Start the listener by registering it with the table and listening for updates.