From 131f29f2ddbd3b2de5c4a8893c1e00e8efd415d5 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 7 Jan 2013 16:19:02 +0100 Subject: [PATCH] Lightweight shutdown hook in web server --- platform/platform-impl/src/org/jetbrains/io/WebServer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/org/jetbrains/io/WebServer.java b/platform/platform-impl/src/org/jetbrains/io/WebServer.java index dd31ba6e7b95..14d180f78294 100644 --- a/platform/platform-impl/src/org/jetbrains/io/WebServer.java +++ b/platform/platform-impl/src/org/jetbrains/io/WebServer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.jetbrains.io; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Computable; +import com.intellij.openapi.util.ShutDownTracker; import com.intellij.openapi.util.SystemInfo; import com.intellij.util.Consumer; import com.intellij.util.concurrency.Semaphore; @@ -293,7 +294,7 @@ public class WebServer { } public void addShutdownHook() { - Runtime.getRuntime().addShutdownHook(new Thread(createShutdownTask())); + ShutDownTracker.getInstance().registerShutdownTask(createShutdownTask()); } public static void removePluggableHandlers(ChannelPipeline pipeline) {