runtime dispatch between different versions of the same module

Jan Van Besien janvanbesien at gmail.com
Wed Feb 4 10:44:00 PST 2009


Hi Jigsaw developers,

I have a question: will the Jigsaw project allow me to dispatch at 
runtime between different versions of the same module?

The language changes will allow me to specify that a module depends on 
another module with a certain version, but probably not on two versions 
of that other module at the same time, correct?

Maybe the API will allow me to do it (with reflection?), but I was 
unable to be sure from the documentation currently available on the website.

I have this use case currently in a project at work, and we solved it 
using different classloaders and with the help of the "transloader" [1] 
library. You can read more about it on my blog [2].

Basically the idea would be to have two versions of the same module that 
both implement the same Java interface (maybe packaged in a third 
module). The "main application" should be able to decide at runtime 
which version of the "implementation module" to use. From the APIs 
available on the website, I think I understand that it is possible to go 
find these two modules, and obtain a classloader for them. But what if I 
call methods on objects instantiated on this classloader from within the 
"main application"? This is a problem we currently solved with the 
transloader library (which serializes and deserializes under the hood). 
Will this situation be different with Jigsaw?

Thanks in advance,
Jan

[1] http://code.google.com/p/transloader/
[2] 
http://janvanbesien.blogspot.com/2008/12/runtime-dispatch-between-different.html



More information about the jigsaw-dev mailing list