implement event loop java callback functions for use in jni