mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-16 19:46:54 +01:00
fix scm-server stop method on windows, see issue #623
This commit is contained in:
@@ -52,6 +52,9 @@ public class ScmServer extends Thread
|
||||
/** Field description */
|
||||
public static final String CONFIGURATION = "/server-config.xml";
|
||||
|
||||
/** Field description */
|
||||
static final int GRACEFUL_TIMEOUT = 2000;
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -113,14 +116,17 @@ public class ScmServer extends Thread
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
* Stop embedded webserver. Use {@link Server#stop()} to fix windows service.
|
||||
*
|
||||
* @see <a href="http://goo.gl/Zfy0Ev">http://goo.gl/Zfy0Ev</a>
|
||||
*/
|
||||
public void stopServer()
|
||||
{
|
||||
try
|
||||
{
|
||||
server.setGracefulShutdown(GRACEFUL_TIMEOUT);
|
||||
server.setStopAtShutdown(true);
|
||||
server.stop();
|
||||
initialized = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -86,7 +86,7 @@ public class ScmServerDaemon implements Daemon
|
||||
public static void stop(String[] args) throws Exception
|
||||
{
|
||||
webserver.stopServer();
|
||||
webserver.join(2000l);
|
||||
webserver.join((long) ScmServer.GRACEFUL_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +113,8 @@ public class ScmServerDaemon implements Daemon
|
||||
public void init(DaemonContext context) throws DaemonInitException, Exception
|
||||
{
|
||||
daemonArgs = context.getArguments();
|
||||
// initialize web server and open port. We have to do this in the init
|
||||
|
||||
// initialize web server and open port. We have to do this in the init
|
||||
// method, because this method is started by jsvc with super user privileges.
|
||||
webserver.init();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user