How to stop a Quarkus application?

Asked

Viewed 96 times

1

I can’t stop a Quarkus application.

After starting a Quarkus application (quarkus.io) even after closing it with Ctrl+C (by command prompt) or clicking the Eclipse Stop button, it still stands. Example: if it goes up to port 8080, even after I stop the application if I type localhost:8080 in the browser the application keeps responding. Another example: if it has a Schedule, it tbm continues running.

I have tried with 3 different projects, with different java versions, different eclipses and even different machines. Always the same problem occurs. I believe there must be some command, parameter or configuration that I should be leaving.

  • Tried applying in the life cycle itself with Quarkus.waitForExit() or Quarkus.asyncExit(); within the method public int run(String... args) ?

2 answers

1


This problem usually happens when initializing the quarkus by an IDE, I usually use the terminal to initialize, and when I need to debug, I perform the remote debug

but if you prefer to continue working with the IDE, when you want to close you will need to perform the following commands

LINUX

inserir a descrição da imagem aqui

the first command will return the process identifier (PID) of the application running on the informed port. Already the following kills the application.

In windowns I found this step by step https://www.techtudo.com.br/dicas-e-tutoriais/noticia/2010/12/como-fechar-um-programa-no-windows-sem-usar-o-gerenciador-de-tarefas.html but I couldn’t test

  • Wouldn’t it just solve the life cycle itself with Quarkus.waitForExit() or Quarkus.asyncExit(); within the method public int run(String... args) ?

0

The correct way to stop an application is by using the Docker commands.

These commands must be executed in the bash (shell) [telinha preta dos hackers].

The commands have been tested in linux environment, in case there is any permission error in the execution of the commands, then try again using sudo in front of the controls. (Remembering that it should not be necessary to use sudo to execute Docker commands, this is one step from the missing configuration).

To list running containers:

docker ps

Exit:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                                        NAMES
5981cbbb9f85        sebp/elk            "/usr/local/bin/star…"   22 hours ago        Up 22 hours         0.0.0.0:5044->5044/tcp, 0.0.0.0:5601->5601/tcp, 9300/tcp, 0.0.0.0:9200->9200/tcp, 9600/tcp   elk7
de6da8c2cd77        redis:alpine        "docker-entrypoint.s…"   2 days ago          Up 22 hours         0.0.0.0:6379->6379/tcp                                                                       redis

After listing the running containers, just stop the ones that are running, so use the command docker stop.

docker stop 5981cbbb9f85

This will stop the container with this id, (releasing the port that was busy). You can check the port that was busy in the command (docker ps)[0.0.0.0:6379->6379/tcp].

If you see the command output docker ps is with this command that you can catch the id of the running container.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.