TraditionalJVMInvocation Page History

Idea for #17, #13

  • Start a traditional JVM process, with a main method.
  • main method spawns a new JVM Thread called Dispatcher.
  • main method then waits on a semaphore. This prevents the JVM from winding down.
  • The Dispatcher thread calls a native method that registers a listener for Javascript window messages. The messages received by this listener are buffered in a queue.
  • The Dispatcher thread then runs a loop and calls a native method called receiveTask.
  • receiveTask() asynchronously requests a message from the queue and returns it to the Dispatcher.
  • These messages are method invocation requests, with a promise resolver attached. These requests are fulfilled by the Dispatcher, and any associated promises are then marked as resolved.

Edit: On second thoughts, a separate dispatcher thread is probably not required. The dispatching could be carried out on the main JVM thread itself.

Last edited by Jim Sproch