How to shutdown com.sun.net.httpserver.HttpServer?

前端 未结 4 1786
暗喜
暗喜 2021-02-10 12:34

The Http Server embedded in JDK 6 is a big help developing web services, but I\'ve got situation where I published an Endpoint and then the code crashed and left the server runn

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-10 13:15

    I've never used this server before and I can't find any good documentation. Perhaps these less elegant solutions have occurred to you already, but I just thought I would mention them.

    Seems like com.sun.net.httpserver.HttpServer has an implementation class called HttpServerImpl. It has a method called stop().

    Or perhaps you can find the Thread listening on the server socket and call interrupt().

    Sean

提交回复
热议问题