Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8213756

SingleInstance runtime improvements



    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: internal
    • Fix Version/s: internal
    • Component/s: tools
    • Labels:


      JPackager's SingleInstanceImplementation has a 2 arg version of registerSingleInstance(), containing a setFileHandler flag whose only effect is on macosx.

      0.) Since this functionality is marginally useful at best, is not cross-platform, and requires jdk.jpackager.runtime to require java.destop we would like to remove it, at least for the initial delivery in JDK12.

      There are other problems in SingleInstanceService that should be addressed.
      1.) each call to registerSingleInstance calls:
              instance = new SingleInstanceServiceImpl();
      which should have been wrapped in a synchronized null check.
      2.) some of the comments are misleading and need rewording.
      such as :
        36 /**
        37 * This method should be implemented by the application to
        38 * handle the single instance behaviour - how should the application
        39 * handle the arguments when another instance of the application is
        40 * invoked with params.
      3.) NewActivation() is only called if there are arguments, otherwise an attempt to launch a second instance just exits.
      This is undocumented behavior and is just wrong. NewActivation should be called before exiting.
      4.) The method getTmpDir is overly complex in an attempt to cover unsupported platforms.
      It should just have cases for "windows", "macosx", and anything else case covering "linux".
      Additionally the "Oracle" (on Mac) and "Sun" will be removed from path elements bother here and in native launcher matching place.
      5.) it has been suggested that registerSingleInstance() should be paired with "deregisterSingleInstance()' instead of "unregisterSingleInstance()'.
      I would rather suggest that the names be changed back to the original names in the jnlp specification: "addSingleInstanceListener()" and "removeSingleInstanceListener()"
      6.) also fix gramatical errors in javadoc.
       "-singleton" must be specified on jpackager command line" should be " --singleton" must be specified on the jpackager command line."
      "for current process" should be "for the current process".
      7.) final request is to change LocalLow to Local in Ttemp path on windows. - this was left overe from deployment code that could run in low integrity mode


          Issue Links



              herrick Andy Herrick
              herrick Andy Herrick
              0 Vote for this issue
              2 Start watching this issue