This content has been marked as final. Show 2 replies
I understand URLClassLoader does not behave this wayNot sure about that. I would investigate further before committing yourself to any code.
I wonder if you know of any utility or project providing this functionality .JNLP.
- Class loader loads the latest version of the classes, checking timestamp or UUID of downloaded cached local classes against those in server.JNLP.
- Downloading the .jar where the .class is packaged instead of just downloading the .class.URLClassLoader already does that. See the Javadoc. It explicitly says that the jar is downloaded.
Finally I have some questions about network class loading:Compared to what? JAR files aren't particularly large, and they are downloaded once at most in the lifetime of the URLClassLoader. Even if URLClassLoader downloaded individual classes, that would only happen once per class per client JVM.
- Does remote class loading overloads the system serving the classes?
- Is remote URL required to be a public folder? I want tokeep my classes privateI guess you could use an Authenticator for that but you'll get tangled up with other uses of it.
and streaming them through a front servlet.You're worried about performance and you're adding extra processing? Just stick them somewhere on an Apache web server, or in a Tomcat under the path to an existing application. You don't need your own servlet for this, it doesn't add anything.
EJP, thanks for your reply.
Let me explain the context:
Client application queries to a scalable web application so client application only performs presentation logic. Client application will be downloading "modules" on demand as it requires them. These modules are simple jars with classes to be loaded in client application for presentation logic. There will be a huge number of modules and only some of them will be used by each user so it doesn't make sense to have a huge jar with all the modules; that's why they will be downloaded as required. More on the context on [this other post|http://forums.oracle.com/forums/thread.jspa?threadID=1773299] .
I thought JNLP is for downloading the whole application once for all and keeping it updated. Can I use JNLP also for downloading independent jars on demand?
Regarding your other answers:
1. Client only knows a key of the jar to be downloaded, so it must query a servlet that maps the key to the actual jar for downloading. Anyway I think I can manage it without this mapping by providing client with the full URL.
2. I researched URLClassLoader time ago and found that I can't use it for my requirements without developing. I don't know the location where it downloads the .class and .jar files, even if it does. Besides I would have latency problems if it has to find a class hidden somewhere in a huge jungle of thousands of remote jars . That's why client must exactly know what it need and where to get it from.
Thanks again. Regards.