netty-http icon indicating copy to clipboard operation
netty-http copied to clipboard

NettyHttpService exit immediately after started

Open ebottabi opened this issue 4 years ago • 3 comments

Trying to start the http service but it exit immediately. What's the recommended approach to start?

image

ebottabi avatar Jul 21 '20 02:07 ebottabi

Hi,

The server started with daemon threads, which is intentional. Depending on your application needs, you can block the JVM exit any way you like. One simple way is to use a CountDownLatch:

CountDownLatch latch = new CountDownLatch(1);
Runtime.getRuntime().addShutdownHook(new Thread(latch::countDown));
NettyHttpService service = NettyHttpService.builder(...)....build();
service.start();
latch.await();
service.stop();

Terence

On Mon, Jul 20, 2020 at 7:18 PM Ebot Tabi [email protected] wrote:

Trying to start the http service but it exit immediately. What's the recommended approach to start?

[image: image] https://user-images.githubusercontent.com/351587/88005219-c4c67380-cb00-11ea-97ec-96fbcdcda077.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cdapio/netty-http/issues/92, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGYCKBHUQWKNHNKS75A2BDR4T3ITANCNFSM4PDBEY6Q .

-- Terence Yim | Staff Software Engineer | [email protected] |

chtyim avatar Jul 21 '20 03:07 chtyim

Thanks Terence for the suggestion.

ebottabi avatar Jul 21 '20 04:07 ebottabi

Resolved two years ago. Close? Generally, this repo and its issues could need some love (maintenance).

fatso83 avatar Apr 19 '22 15:04 fatso83