March 29, 2005

Shiny New Toy on the Horizon...

Finally it looks like we might be getting something that I have always dreamed of.


http://java.sun.com/developer/technicalArticles/Programming/mvm/


I (among many others) have long wanted a way to reliably use a JVM as a true Virtual Machine. To be able to run multiple applications with only the overhead of starting one runtime. It should speed up Swing applications and make ridiculous java startup times a thing of the past.

It has always been feasible to go some way to achieve this kind of thing using a custom java application. This application would take several parameters at the command line:

  • The classpath for the application class to run.
  • The name of the application class to run.
  • Any parameters to be passed to the application class.
When the custom application class was run it would try to connect to a local socket trying to find a running instance of itself. If it found a running instance it would communicate the parameters for the application to be run over the socket and terminate. If it didn't find a running instance it would instantiate a classloader with the relevant classpath, reflectively instantiate the class from the new classloader and run it's main method, passing in the specific parameters. It would then continue running, listening on a socket for any more applications to run.


While this approach does a very effective job of reducing the footprint of running applications, it does not address the startup time (a new JVM instance is started for every application) nor does it properly isolate the applications (locales, system properties, System.exit() all combine to throw a spanner into the works).


I'm looking forward to playing with the research release of the MVM when it becomes available.

No comments: