New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating a jar while the application is still running #64
Comments
The more I dive into the details, the more I think it's actually a "bug" in What do you think? |
Getdown was never designed for this use case. The "ping a URL to see if there's an update" mode was always intended only for development use and never for production apps. The "versioned" update mode requires that the APP check whether there's an update, and when there is, the APP should write a There is no simple cross platform way that Getdown can coordinate with the app to ensure that it's not already running, so Getdown, in production mode, never updates the app unless the app says that it needs to be updated. All of this confusion and overwriting files and corruption and blah blah is the result of people using the "development" mode of Getdown for production. It's easier to set up because you don't have to write code in your app to track new versions, but it isn't robust and cannot easily be made robust without coordination from the app. That's why we have the versioned mode in the first place. |
Indeed, I wasn't aware that this mode isn't intended for production use. My bad! I re-read the Design Goals and, keeping Getdown's background in mind, it totally makes sense what you write. So, thanks for the clarification. -- Thomas |
It's actually not hard to integrate version tracking in an existing app which will then instruct Getdown to run an update. The hardest part is to coordinate a shutdown of all application instances so that an update of the code resources can take place. Lots of our customers are using Citrix, so we have a lot of users running our application from the same host (and directory). I think you can imagine how hard it is in this scenario to run an update. I experimented a bit and modified Getdown so that it starts the application from a "cache" directory instead of the installation directory. The cache is structured like so:
So, whenever an update is available new files are installed into the cache and new application instances are started from there. No existing jars are actually replaced. The usage of the jar files is tracked by the As far as I remember, Java Web Start uses a similar mechanism. Microsoft's ClickOnce, to a certain extent, caches application versions as well. Although I know that this cannot be incorporated into Getdown easily without breaking current functionality (I think of unpacked resources), I want to share my idea in the hope it helps others. -- Thomas |
On Thu, Sep 8, 2016 at 11:51 AM, Thomas Küstermann <notifications@github.com
However, it would not be unreasonable to allow an app to opt-into this more Indeed, with the benefit of 12 years of hindsight, Getdown could do with a Assuming your modifications simply copy the code + resources into a cache |
Sounds great! Before I submit a PR, let's talk about what is to be implemented exactly, so everyone has a clear understanding. What I have in mind is to populate a cache for all classpath resources (code & resource jars) after Getdown has downloaded all bits and before the application is launched. It will be ensured that each file is contained in the cache only once. The cache won't contain resource jars which are not part of the classpath as well as unpacked resources. Although it's possible to have different "working folders" per application instance, I consider this way too error prone and complex to be implemented in a timely manner. Let's start simple and evolve if necessary. The (code) cache should only be used if it is activated by a specific configuration property in the
The cache contains the jar files along with What do you think, is this sufficient? Please feel free to add more requirements. |
That sounds pretty good to me. I assume the current working directory will be the same (the main application directory, not the cache directory) and only the classpath will be adjusted to reference the jars from the cache directory. This would ensure that apps will otherwise mostly work the same, just without the jar file stomping during update. I think for |
…nstances Whenever 'use_code_cache' is set to 'true' the application's code resources are copied to a cache directory prior to launching the application. This is done in order to support multiple open application instances of different versions.
I just changed our application delivery so that
getdown
is responsible to install the application and keep it up-to-date. Now, I have the following situation:getdown
. It opens and everything is fine.getdown
is now running an update because I changed a jar file (by intention).ClassNotFoundException
.As far as I know this is the expected result if a jar file is being replaced while an application is running. What can be done in order to prevent such situations? I'm on Windows 8.1 if that helps.
I'm still new to
getdown
, so bear with me if that's a configuration issue or this question has already been asked.Regards,
-- Thomas
The text was updated successfully, but these errors were encountered: