add java multi-thread code to wait for interrupt from C code