This closes #1007
This commit is contained in:
commit
972f846f01
|
@ -29,6 +29,7 @@ import org.apache.activemq.artemis.components.ExternalComponent;
|
||||||
import org.apache.activemq.artemis.dto.AppDTO;
|
import org.apache.activemq.artemis.dto.AppDTO;
|
||||||
import org.apache.activemq.artemis.dto.ComponentDTO;
|
import org.apache.activemq.artemis.dto.ComponentDTO;
|
||||||
import org.apache.activemq.artemis.dto.WebServerDTO;
|
import org.apache.activemq.artemis.dto.WebServerDTO;
|
||||||
|
import org.apache.activemq.artemis.utils.FileUtil;
|
||||||
import org.apache.activemq.artemis.utils.TimeUtils;
|
import org.apache.activemq.artemis.utils.TimeUtils;
|
||||||
import org.eclipse.jetty.server.Connector;
|
import org.eclipse.jetty.server.Connector;
|
||||||
import org.eclipse.jetty.server.HttpConfiguration;
|
import org.eclipse.jetty.server.HttpConfiguration;
|
||||||
|
@ -43,9 +44,12 @@ import org.eclipse.jetty.server.handler.HandlerList;
|
||||||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
import org.eclipse.jetty.server.handler.ResourceHandler;
|
||||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||||
import org.eclipse.jetty.webapp.WebAppContext;
|
import org.eclipse.jetty.webapp.WebAppContext;
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
public class WebServerComponent implements ExternalComponent {
|
public class WebServerComponent implements ExternalComponent {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(WebServerComponent.class);
|
||||||
|
|
||||||
private Server server;
|
private Server server;
|
||||||
private HandlerList handlers;
|
private HandlerList handlers;
|
||||||
private WebServerDTO webServerConfig;
|
private WebServerDTO webServerConfig;
|
||||||
|
@ -145,12 +149,19 @@ public class WebServerComponent implements ExternalComponent {
|
||||||
//tmpdir will be removed by deleteOnExit()
|
//tmpdir will be removed by deleteOnExit()
|
||||||
//somehow when broker is stopped and restarted quickly
|
//somehow when broker is stopped and restarted quickly
|
||||||
//this tmpdir won't get deleted sometimes
|
//this tmpdir won't get deleted sometimes
|
||||||
boolean fileDeleted = TimeUtils.waitOnBoolean(false, 10000, tmpdir::exists);
|
boolean fileDeleted = TimeUtils.waitOnBoolean(false, 5000, tmpdir::exists);
|
||||||
if (!fileDeleted) {
|
if (!fileDeleted) {
|
||||||
|
//because the execution order of shutdown hooks are
|
||||||
|
//not determined, so it's possible that the deleteOnExit
|
||||||
|
//is executed after this hook, in that case we force a delete.
|
||||||
|
FileUtil.deleteDirectory(tmpdir);
|
||||||
|
logger.debug("Force to delete temporary file on shutdown: " + tmpdir.getAbsolutePath());
|
||||||
|
if (tmpdir.exists()) {
|
||||||
ActiveMQWebLogger.LOGGER.tmpFileNotDeleted(tmpdir);
|
ActiveMQWebLogger.LOGGER.tmpFileNotDeleted(tmpdir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
webContexts.clear();
|
webContexts.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue