Platform Services for GlassFish 3.1

Platform Services are capabilities provided by the different operating system platforms. In Solaris 10 it is SMF (Solaris Management Framework), on Linux and other UNIX flavors including older Solaris systems it is controlled by daemons that read special configuration files. On Windows, a Services framework is provided that uses a special API.

Goals for later versions of GlassFish:

  • seamless use of services for life-cycle management. E.g. when you run 'asadmin stop-domain' it would check and see if the domain is running as a service or not and then act accordingly.
  • Support services on all supported platforms

Unfortunately this is beyond the scope of 3.1. It will require 3-6 man months of work.

What do we currently support in GlassFish 3.x ?

  • Supported Platforms are Solaris 10 with SMF and Windows
  • asadmin has the create-service command which creates the service on either of the supported platforms.  Domains are supported only.
  • After creating – the user is on his own – all start/stop/uninstall operations have to be done directly with the platform. We document how to do it.

    What CAN we do for 3.1?

  • Add support for Linux: Oracle Enterprise Linux, Redhat Enterprise Linux, Ubuntu
  • Add support to create services for instances

Commands

  • create-service – Sets up services for DAS
  • create-instance-service – Sets up services for an instance

What are Future Goals for 3.2 and onwards?

  • start/stop/list/uninstall commands  for controlling all aspects of the services from within asadmin
  • Add an attribute to the server element in domain.xml specifying when a server is a service
    • Elegant Solution: We don't write special life-cycle commands. Instead existing commands like stop-instance would make special Services call if that instance is running as a service.
  • Support more platforms -- MAC, HPUX(?), Solaris w/o SMF, other flavors of Linux
  • Tight sophisticated 2way integration

Best Practices when Running As A Service

The overall rule is to use the same tools for handling life-cycle.  If you setup a remote instance as a service then you should allow the services implementation of the operating system to do all the starting, stopping and restarting.  If you are using services to control the life-cycle of your server(s) then you shouldn't use the life-cycle control commands that GlassFish provides:

  • start-instance
  • start-domain
  • start-local-instance
  • stop-instance
  • stop-domain
  • stop-local-instance
  • restart-instance
  • restart-domain
  • start-cluster
  • stop-cluster

Instead -- use the capabilities of your platform services.  They are just as easy to use.  You can also control remote services with the built-in platform tools.

Failure Mode Handling FAQ

Q: Remote server is started by asadmin, user goes to services to stop the instance. What happens?

A: Windows and Solaris/SMF did not start it so they will not be able to see it or stop it.  Linux and non-SMF Solaris are very low-level.  Stopping via services will work because it will just run a simple script command.

Q: Remote server is started by service; user stops the server using asadmin (stop-cluster or stop-instance). What happens?

A: The service notices that the server stopped.  It is marked as not-running. There are ways, depending on the platform, to have the operating system services automatically restart for you.  That is beyond the scope for GlassFish.  To set that up you'll need to study your platform's services.