var Log = java.import('bla.trace.Log');var logger = java.newProxy('bla.trace.Logger', {emit: function (message) {console.log(message);}});
setInterval(function () {logger.ref();}, 1000);
Log.setLoggerSync(logger);
/// kick off some code that will cause Java code to execute, calling Logger.emit() to fire off from time to time.
package bla.trace;public interface Logger {void emit(String message);}
package bla.trace;public class Log {private Logger logger;/* to use this class, pass a dynamic proxy from Nodejs whichdefines an emit callback function ( function (message) { } )*/public static void setLogger(Logger logger) {INSTANCE.logger = logger;}public static void unsetLogger() {INSTANCE.logger = null;}private static final Log INSTANCE = new Log();public static void trace(String message) {INSTANCE.emit(message);}private void emit(String message) {if (this.logger != null ) {this.logger.emit(message);}}}
## A fatal error has been detected by the Java Runtime Environment:## Internal Error (safepoint.cpp:717), pid=21655, tid=1287# fatal error: Illegal threadstate encountered: 4## JRE version: Java(TM) SE Runtime Environment (7.0_55-b13) (build 1.7.0_55-b13)# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.55-b03 mixed mode bsd-amd64 compressed oops)# Core dump written. Default location: /cores/core or core.21655## An error report file with more information is saved as:# /Users/matt/development/bla/lib-node-pricing/hs_err_pid21655.log## If you would like to submit a bug report, please visit:# The crash happened outside the Java Virtual Machine in native code.# See problematic frame for where to report the bug.#[1] 21653 abort (core dumped) mocha test/csv/csv.js
## A fatal error has been detected by the Java Runtime Environment:#
# Internal Error (safepoint.cpp:717), pid=89928, tid=1287
# fatal error: Illegal threadstate encountered: 4## JRE version: Java(TM) SE Runtime Environment (7.0_55-b13) (build 1.7.0_55-b13)# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.55-b03 mixed mode bsd-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
## An error report file with more information is saved as:
# /Users/matt/development/scratch/node-java-proxy-test/hs_err_pid89928.log
## If you would like to submit a bug report, please visit:# The crash happened outside the Java Virtual Machine in native code.# See problematic frame for where to report the bug.#
[1] 89928 abort node index.js