Git Product home page Git Product logo

Comments (7)

samskivert avatar samskivert commented on September 3, 2024

There's no configuration for doing this in the code, but depending on what you're trying to accomplish, maybe some hackery can get you there.

Is your intent to download code/resources that are presumably not yet downloaded and then just stop?

from getdown.

davidsteinsland avatar davidsteinsland commented on September 3, 2024

The main reason is that I need to stop a service before getdown, and start
it After. *then * I start the main application.
5. juni 2014 18:36 skrev "Michael Bayne" [email protected]
følgende:

There's no configuration for doing this in the code, but depending on what
you're trying to accomplish, maybe some hackery can get you there.

Is your intent to download code/resources that are presumably not yet
downloaded and then just stop?


Reply to this email directly or view it on GitHub
#6 (comment).

from getdown.

samskivert avatar samskivert commented on September 3, 2024

On Thu, Jun 5, 2014 at 11:37 AM, David Steinsland [email protected]
wrote:

The main reason is that I need to stop a service before getdown, and start
it After. *then * I start the main application.

OK, then I think the approach I had in mind may be useful.

You can pass system properties to the Getdown app which are passed through
to your app. So you could do:

java -jar getdown.jar -Dapp.update-only=true appdir

which will then pass -Dupdate-only=true to your app when it is run. Your
app can check for update-only first thing and if it sees that, then it can
just exit immediately.

That way, whatever is running Getdown will cause it to do its natural
updating, and then "run" the app, which will just exit immediately. Then
you can run your app however you like, without the -Dupdate-only system
property, which will cause it to run as normal. That could be by reinvoking
Getdown (which will see that everything is up to date and just run your
app), or by whatever other means you like.

-- [email protected]

from getdown.

davidsteinsland avatar davidsteinsland commented on September 3, 2024

yeah, thank you. much simpler!

on a side note.. is it possible to update getdown by specifying it as a resource, or will this completely break the classloader?

from getdown.

samskivert avatar samskivert commented on September 3, 2024

On Fri, Jun 6, 2014 at 6:37 AM, David Steinsland [email protected]
wrote:

on a side note.. is it possible to update getdown by specifying it as a
resource, or will this completely break the classloader?

I was going to point you to the wiki page on updating Getdown, but I
haven't written it yet! Ha!

You can update Getdown, but you have to jump through hoops, because as you
suspect, if you update the getdown.jar that is actually running Getdown, it
will crash and burn.

What we do is to add:

resource = getdown-new.jar

to our apps, and then there's a helper class in Getdown called LaunchUtil
which defines:

/**
 * Upgrades Getdown by moving an installation managed copy of the

Getdown jar file over the
* non-managed copy (which would be used to run Getdown itself).
*
*

If the upgrade fails for a variety of reasons, warnings are
logged but no other actions
* are taken. There's not much else one can do other than try again
next time around.
*/
public static void upgradeGetdown (File oldgd, File curgd, File newgd)

The way to use it is to put getdown.jar in your app's classpath, and then
call LaunchUtil.upgradeGetdown() during your apps startup phase.
upgradeGetdown() does the following:

delete oldgd
move curgd to oldgd
move newgd to curgd
copy curgd back to newgd

This three way shuffle is to avoid conflicts if Getdown is still running
for any reason and has curgd open (which on Windows will prevent it from
being deleted or copied over, but not renamed), and also to avoid issues if
the user's disk happens to reach 100% full during this process.

Also upgradeGetdown() does nothing if curgd and newgd are the same size
(which it uses as a proxy for tracking whether it already did the upgrade).

-- [email protected]

from getdown.

davidsteinsland avatar davidsteinsland commented on September 3, 2024

Aha, so something like this then:

...
public static void main(...) {
    com.threerings.getdown.util.LaunchUtil.upgradeGetdown(new File("getdown-old.jar"), 
        new File("getdown.jar"), 
        new File("getdown-new.jar"));
}
java -cp getdown.jar:app.jar com.myapp

from getdown.

samskivert avatar samskivert commented on September 3, 2024

Exactly.

from getdown.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.