Launcher Rework for V3

Admin Overall Task List

  • Ability to embed AppServer in any arbitrary JVM, with the proviso that the JVM has a list of required options already set – e.g. -Xmx
  • Ability to easily start AppServer in its own JVM from any java code with no restrictions.
  • Stretch Goal: Start AppServer remotely – probably via NodeAgent.
  • Stretch Goal: ability to run a cluster in one JVM. This will require radical changes all over the place – e.g.
    • System.getProperty('com.sun.aas.instanceRoot") – this will be trouble if there are multiple instances in one JVM

Mechanics

  • Rewrite of startup code. v2 was purposefully a hack of the old code. The code was so convoluted and ultra-complex that this was deemed the safest way to proceed. The rewrite was successful and safe, now we can jettison native startup and make the code much simpler and easier to maintain.

What is Launching?

The meaning has changed. In v2 and earlier, launching is getting from a commandline to the first line of code in the actual appserver. I.e. the launcher creates a JVM process with the appserver main method as the class to run. In the context of v3, it is that plus starting the appserver embedded - i.e. running in the same JVM as the launcher itself.

In any case launching and startup are different parts of getting a server up and running.

  • launching is everything before the first server code runs
  • startup is after the first server code starts

What Does Launcher Do in the non-embedded case?

  • Looks at the arguments and options it was given and handles them appropriately
  • Figures out what kind of server to start: DAS, NA, instance
  • Figures out where the server lives on disk
  • Gets the JVM options from the correct config file (domain.xml)
  • If the server is secure, it hands off username-password information
  • Creates a JVM process with a commandline dependent on the above
  • Attaches 2 daemon threads to make sure stdout/stderr is drained from the spawned process properly
    • it might display the drained output, depending on settings, and run the entire time the server runs
    • it might exit/return immediately after the JVM starts

What Does Launcher Do in the embedded case?

It does everything in the list above with these differences

  • it does NOT look into domain.xml thus ignoring all jvm-options therein
  • It does not create a JVM process. Instead it instantiates and calls the appropriate server startup class
  • daemon threads are not needed
  • the launcher remains in the same VM as the server

API

LauncherAPI