Is it possible to implement Runnable on python side?
I am trying following code
import threading
import jep
from jep import jproxy
from java.lang import Thread
print("main ident:", threading.get_ident())
class RunnableImpl(object):
def run(self):
print("thread ident:", threading.get_ident())
myrunnbale = jproxy(RunnableImpl(), ['java.lang.Runnable'])
t = Thread(myrunnbale)
t.start()
t.join()
but got following exception:
main ident: 52228
Exception in thread "Thread-1" java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy0.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
Caused by: jep.JepException: Invalid thread access.
at jep.Jep.isValidThread(Jep.java:466)
at jep.InvocationHandler.invoke(InvocationHandler.java:123)
... 2 more
It is supported use-case?