Does prunsrv.exe use multiple threads to run a Java application as a service?
<p>Configured a <code>jvm</code> mode Java Windows service following this tutorial: (<a href="https://joerglenhard.wordpress.com/2012/05/29/build-windows-service-from-java-application-with-procrun/" rel="nofollow noreferrer">https://joerglenhard.wordpress.com/2012/05/29/build-windows-service-from-java-application-with-procrun/</a>). I am printing log messages by thread ID to a file in the start and stop methods as follows:</p>
<pre><code> private static boolean stop = false;
    public static void main( String[] args )
    {
    log.debug(Integer.toHexString(System.identityHashCode(Thread.currentThread())));
    if (args.length == 0) {
        log.debug(&quot;no args provided, give start/stop as argument&quot;);
        return;
    }
    String mode = args[0];
    if (&quot;start&quot;.equals(mode)) {
        log.debug(&quot;start &quot; + Integer.toHexString(System.identityHashCode(Thread.currentThread())));
        startService(args);
    } else if (&quot;stop&quot;.equals(mode)) {
        log.debug(&quot;stop &quot; + Integer.toHexString(System.identityHashCode(Thread.currentThread())));
        stopService(args);
    }
    log.debug(&quot;End of main &quot; + Integer.toHexString(System.identityHashCode(Thread.currentThread())));
    }
</code></pre>
<p>This is the log output showing the services starting and stopping:</p>
<pre><code>22/Aug/2016 19:22:00,962- App: 441772e
22/Aug/2016 19:22:00,962- App: start 441772e
22/Aug/2016 19:22:00,962- App: startService
22/Aug/2016 19:23:21,259- App: 1ef37254
22/Aug/2016 19:23:21,259- App: stop 1ef37254
22/Aug/2016 19:23:21,259- App: stopService
22/Aug/2016 19:23:21,259- App: End of main 1ef37254
22/Aug/2016 19:23:22,181- App: End of main 441772e
</code></pre>
<p>The threads IDs appear in the log file which indicates that a new process is started for start service and stop service. Even though the variable <code>stop</code> is a <code>private static boolean</code> the log file shows that the service are different process (Right?). So, why are multiple Windows processes being created to start and stop my service?</p>