duct-framework / duct

Server-side application framework for Clojure
MIT License
1.13k stars 51 forks source link

Block main thread indefinitely after starting system #52

Closed ku1ik closed 7 years ago

ku1ik commented 7 years ago

We need to block main thread to prevent system from shutting down immediately after starting.

With default jetty server this (accidentally) isn't a problem as it apparently creates some non-daemon threads. However if you switch to a different server component which doesn't create non-daemon threads the app exits immediately.

(I found this issue after switching to Aleph component)

weavejester commented 7 years ago

Thanks for the PR! A (Thread/wait) might be a better choice in this case, though.

ku1ik commented 7 years ago

Hmm, no such thing as (Thread/wait), you meant something else?

ku1ik commented 7 years ago

(.. Thread currentThread join) ?

weavejester commented 7 years ago

Ah, sorry, I always forget that wait works strangely. It's Object.wait rather than Thread.wait, and it needs to be called inside a synchronized method and has other annoying conditions.

(.. Thread currentThread join) is a better solution. Let's go with that.

ku1ik commented 7 years ago

There you go.

weavejester commented 7 years ago

Fixed in 0.9.0