glassfish
  1. glassfish
  2. GLASSFISH-16311

Improve operating service (OS) integration

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 3.1
    • Fix Version/s: future release
    • Component/s: admin
    • Labels:
      None
    • Environment:

      Windows, Linux, Solaris

      Description

      This RFE is for improving the operating system (OS) service integration for GlassFish. Here are the requirements:

      1. Expose the asadmin delete-service interface as a public interface (rather than being hidden as it is currently).

      2. Modify the service implementation so that it acts as a monitor on all operating systems. By monitor, this means that if the service is started, then if the GlassFish process exits, it should be restarted automatically. The Windows service currently doesn't work this way - I'm not sure for Linux and Solaris.

      3. Modify the service implementation and/or the various start/stop commands so that they interact correctly. This includes:

      3a. If the OS service is started, and the user runs stop-local-instance or stop-domain, then the OS service should be stopped too.

      3b. If the server is started using start-domain or start-local-instance, and the OS service is not started, the OS service should not be started. However, if the user then later starts the OS service, the OS service must recognize that the server is already running and monitor the already running server (See req. #2).

      4. Any sequence of OS service commands and asadmin start/stop-domain or start/stop-local-instance commands must not cause a failure of the command. For example, currently, if you start the Windows OS service for a domain, and then run stop-domain, and then try to stop the Windows OS service, you get an error message from Windows. Also on Windows, if you run start-domain, and then start the OS service, you get an error message saying that "The process terminated unexpectedly." and the service isn't started.

      5. The service should be able to be deleted using either the operating system command for deleting services or the asadmin delete-service command. So the following sequences should work:

      asadmin create-service
      OS delete service command
      asadmin create-service
      asadmin delete-service

      Currently, the 2nd create-service in this sequence may require a --force option. Ideally, it shouldn't.

      6. These requirements apply to the officially supported operating systems for GlassFish for Windows, Linux, and Solaris.

        Issue Links

          Activity

          Hide
          Tom Mueller added a comment -

          Marking the fix version field as "future-release". This is based on an evaluation by John, Michael, and Tom WRT to the PRD for the Java EE 7 RI/SDK. This issues was deemed to not be a P1 for that release. If this is in error or there are other reasons why this RFE should be targeted for the Java EE 7 RI/SDK release, then change the fix version field back to an appropriate build.

          Show
          Tom Mueller added a comment - Marking the fix version field as "future-release". This is based on an evaluation by John, Michael, and Tom WRT to the PRD for the Java EE 7 RI/SDK. This issues was deemed to not be a P1 for that release. If this is in error or there are other reasons why this RFE should be targeted for the Java EE 7 RI/SDK release, then change the fix version field back to an appropriate build.
          Hide
          mkarg added a comment -

          My idea is basing on in-process because it is the natural way on Windows to implement services, and it simplifies the complexity by far, as there is no more watchdog asadmin needed. GlassFish will just feel and behave as a native service, so no more scripts are involved. Windows admins don't like scripts, as Windows has a completely different architecture compared to UNIX. UNIX does everything in scripts, Windows does virtually nothin in scripts. So the target is, to get rid of scripts.

          Thank you Byron for the hint. Actually I looked for the single entry points in Java source code that make the following happen (in pseudo code):

          • GlassFish.start!
          • GlassFish.stop!
          • (opt.) GlassFish.pause!
          • (opt.) GlassFish.resume!
          • GlassFish.state?

          If that is not existing, I will inspect what the scripts do and repeat that in pure Java (hence my question about building from scratch; got that meanwhile using svn and mvn BTW). My target is to provide java source that is using / implementing the native Windows API that directory executes this commands in-process.

          Show
          mkarg added a comment - My idea is basing on in-process because it is the natural way on Windows to implement services, and it simplifies the complexity by far, as there is no more watchdog asadmin needed. GlassFish will just feel and behave as a native service, so no more scripts are involved. Windows admins don't like scripts, as Windows has a completely different architecture compared to UNIX. UNIX does everything in scripts, Windows does virtually nothin in scripts. So the target is, to get rid of scripts. Thank you Byron for the hint. Actually I looked for the single entry points in Java source code that make the following happen (in pseudo code): GlassFish.start! GlassFish.stop! (opt.) GlassFish.pause! (opt.) GlassFish.resume! GlassFish.state? If that is not existing, I will inspect what the scripts do and repeat that in pure Java (hence my question about building from scratch; got that meanwhile using svn and mvn BTW). My target is to provide java source that is using / implementing the native Windows API that directory executes this commands in-process.
          Hide
          Byron Nevins added a comment -

          I'm not sure what you mean by "the few Java lines needed to issue a GF startup / shutdown / status-query". Perhaps you mean this?

          How to start, stop, check status of domain

          java -jar "%GF_HOME%\modules\admin-cli.jar" start-domain
          java -jar "%GF_HOME%\modules\admin-cli.jar" stop-domain
          java -jar "%GF_HOME%\modules\admin-cli.jar" list-domains

          How to start, stop, check status of instance

          java -jar "%GF_HOME%\modules\admin-cli.jar" start-local-instance instance1
          java -jar "%GF_HOME%\modules\admin-cli.jar" stop-local-instance instance1
          java -jar "%GF_HOME%\modules\admin-cli.jar" list-instances --long

          ------------------
          If you mean the source lines that run from the above calls – they are definitely not "few". There are thousands of lines required. They are located in admin/launcher, core/kernel, core/bootstrap, cluster/cli, cluster/admin and common/common-util (off the top of my head)

          Show
          Byron Nevins added a comment - How to build glassfish from scratch ** ======================================= svn co https://svn.java.net/svn/glassfish~svn/trunk/main cd appserver mvn install ======================================= I'm not sure what you mean by "the few Java lines needed to issue a GF startup / shutdown / status-query". Perhaps you mean this? How to start, stop, check status of domain java -jar "%GF_HOME%\modules\admin-cli.jar" start-domain java -jar "%GF_HOME%\modules\admin-cli.jar" stop-domain java -jar "%GF_HOME%\modules\admin-cli.jar" list-domains How to start, stop, check status of instance java -jar "%GF_HOME%\modules\admin-cli.jar" start-local-instance instance1 java -jar "%GF_HOME%\modules\admin-cli.jar" stop-local-instance instance1 java -jar "%GF_HOME%\modules\admin-cli.jar" list-instances --long ------------------ If you mean the source lines that run from the above calls – they are definitely not "few". There are thousands of lines required. They are located in admin/launcher, core/kernel, core/bootstrap, cluster/cli, cluster/admin and common/common-util (off the top of my head)
          Hide
          Bill Shannon added a comment -

          Ideally you would just issue the "asadmin start-domain" command to
          start the app server. Is there some reason you need to start it
          "in process"? If so, you'll need to duplicate the environment setup
          from asadmin.bat and then start a JVM using the same arguments that
          asadmin.bat does.

          In any event, Byron is the expert on starting GlassFish.

          Also, hopefully, you wouldn't need to build GlassFish in order to do
          this, but if you did there's build instructions on the wiki.

          Show
          Bill Shannon added a comment - Ideally you would just issue the "asadmin start-domain" command to start the app server. Is there some reason you need to start it "in process"? If so, you'll need to duplicate the environment setup from asadmin.bat and then start a JVM using the same arguments that asadmin.bat does. In any event, Byron is the expert on starting GlassFish. Also, hopefully, you wouldn't need to build GlassFish in order to do this, but if you did there's build instructions on the wiki.
          Hide
          mkarg added a comment -

          Bill,

          I would be happy to provide an implementation, but I have no strong GlassFish internals background, so I will need help with that. What I can provide is the complete JNA or C++ code for a "good and complete" "real" Windows service, but what I need it someone that will tell me (a) how to build GlassFish from scratch and (b) the few Java lines needed to issue a GF startup / shutdown / status-query. If we can organize this then I will be glad to provide the complete Windows part.

          Regards
          Markus

          Show
          mkarg added a comment - Bill, I would be happy to provide an implementation, but I have no strong GlassFish internals background, so I will need help with that. What I can provide is the complete JNA or C++ code for a "good and complete" "real" Windows service, but what I need it someone that will tell me (a) how to build GlassFish from scratch and (b) the few Java lines needed to issue a GF startup / shutdown / status-query. If we can organize this then I will be glad to provide the complete Windows part. Regards Markus

            People

            • Assignee:
              Byron Nevins
              Reporter:
              Tom Mueller
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: