1

I am writing a Java server-side application, and I want to provide built in functionality so that the apple can update itself. I want the application to poll a server, and if there are a new version that it can update to, then it should let the user activate the update command.

I would like the following to happen during this update:

  • Download a new JAR file with the new version
  • Reload the contents of that JAR into the main application
  • Unload any old classes from the old JAR

I would like this to happen, ideally, without having the applications PID change during this process.

I believe Jenkins does do this, but I haven't been able to figure out just how they are able to do so.

Joachim H. Skeie
  • 1,893
  • 17
  • 27

1 Answers1

0

The unload/load technique is standard with Java EE applications deployed into an app container, you get that for free.

The only issue is how to manage the update programatically. It's bound to be container-specific. If you are not deploying to a Java EE container, the you'll have to delve into the gory details of custom classloaders. But that's only going to be the start since there is way more to it than just unloading classes. Your app may have started threads that will need to be shut down gracefully, for example, or opened sockets, etc.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Marko Topolnik
  • 195,646
  • 29
  • 319
  • 436