ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

JVM restart?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • JVM restart?

    Hello all,

    I've just finished writing my first bit of Java to run on the iSeries. Its a program that generates a PDF order confirmation and plops it on the IFS. It gets called from an RPG program that is part of a CGIDEV2 application. That was the easy bit. I've created some files with the compile options as well so people can make changes and then run a few simple QShell commands to rebuild the jar.

    My problem is this, if we want to deploy a hotfix is there an equivalent of something like reclaiming activation groups? So far what I have found is that each job gets its own JVM instance which then loads in the classes it needs. As far as I know there is no way of unloading a class. One can end the JVM for a job but it appears that you can only start a JVM once for each job so its curtains once you end it.

    The only thing I've found that works is ending all the jobs and creating new ones. Any other suggestions?
    Thanks
    Ben

  • #2
    Re: JVM restart?

    Someone might know better than me, but I think your assessment seems pretty accurate. I'm not really sure if there is a way to deploy a new class to the JVM on the fly like that. That requires a recompile of the source, which the JVM would need to restart to institute those changes since it does a lot of run time build stuff.

    I'll do some checking in a couple books I have here and I'll let you know if I find something.
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

    Comment


    • #3
      Re: JVM restart?

      from everything i've seen as of v5r2 that is the case once the JVM is loaded, that's it. the only way to restart the JVM is by creating new jobs.
      I'm not anti-social, I just don't like people -Tommy Holden

      Comment


      • #4
        Re: JVM restart?

        I'm going to toss your question out onto another java forum. I'll let you know what I find out.
        Your future President
        Bryce

        ---------------------------------------------
        http://www.bravobryce.com

        Comment


        • #5
          Re: JVM restart?

          Here's what I would do to test it out. I would write a program that maybe writes 'hello world' to a spool file every 10 minutes. Then, after submitting the job with this class, you will have 10 minutes to change the message that the class prints out. Recompile the source of the class and see what message the job prints in the spool file the next time it executes that statement. Then you will have your answer.

          Just a thought...
          Your future President
          Bryce

          ---------------------------------------------
          http://www.bravobryce.com

          Comment


          • #6
            Re: JVM restart?

            This test wasn't necessary as I had done something similar. I had changed the way the Java program displayed the company logo on the PDF. However, this change wasn't being picked up when I rebuilt the jar. It only got picked up again after I had ended the job the Java runs in and created a new one.

            We now have a command that ends the relevant jobs and replaces them with new ones. This may result in a brief slowdown of the web app but so does reclaiming activation groups. At least it means we have the facility to hot deploy should we need to.
            Ben

            Comment


            • #7
              Re: JVM restart?

              Thanks btw
              Ben

              Comment


              • #8
                Re: JVM restart?

                I just got this back from someone on the JavaRanch forum...I hope it helps maybe later on sometime...

                You can load and unload your classes with your own custom classloader.
                so you could write your own classloader to just do a refresh. You would probably have to make sure that no one is using the class at the time of the running of the classloader I would assume. But its quicker and better than taking the whole thing down
                Your future President
                Bryce

                ---------------------------------------------
                http://www.bravobryce.com

                Comment

                Working...
                X