Jetty server join why




















Arrays java. File java. Collections java. TimeUnit java. URL org. Before java. Properties java. URI org. Assert javax. HttpServletRequest java.

Paths javax. HttpServletResponse org. BeforeClass java. InetSocketAddress javax. ServletException java. EnumSet org. Call of join guarantees that after it the server is indeed ready. Task implements Runnable , so when you call handler. That will hang the UI. You should start the task in a background thread, either via an executor or simply by calling new Thread handler.

Hope this helps, if you want more details, please use the jetty-users mailing list, as this sort of question is really inappropriate for stackoverflow. This is from the EmbedMe. The problem I found is that when you have a war embedded within a jar, the URIs can end up being ones that do not work with the default jar: uri handler trying to access the war file.

Implement your own URI handler that was an interesting exercise, but if you need to support the code yourself, I would not recommend doing that.

Make the war file an executable war file, e. To do this you overlay the jetty server classes and your main class with the war file. It works fine without it. Improve this question. Brad Koch Loner shushman Loner shushman 3 3 gold badges 7 7 silver badges 18 18 bronze badges. Add a comment. Active Oldest Votes. Improve this answer.

AlexR AlexR k 14 14 gold badges silver badges bronze badges. Which includes all of the components you specify and attach to the Server before the call to Server. Note however that some components, such as the DeploymentManager which the question does not use have their own thread which is not beholden to this generalization. It is good practice, for example, to ask the Connectors for their state after Server. Should I care that the JVM is not shut down but the main exit.? The main exit, that is fine but the server is still running in the background, which is what I want — Loner shushman.

Why is this upvoted and accepted when clearly the answer is wrong? Like JoakimErdfelt said, join waits for the server thread to stop and not until the server has fully started.

I removed the join and everything works as usual.



0コメント

  • 1000 / 1000