Fork me on GitHub

hi all, quick question for JVM experts. Assuming I start a core.async process which loops forever, should I register a JVM shutDownHook to stop it ?


@val_waeselynck in most situations like that, I prefer to just start a java thread in daemon mode, so I don’t have to worry about the internal details of how the core.async processes are being run (which is not guaranteed not to change in future versions)


@tanzoniteblack not sure I understand, what thread should be started in daemon mode? I'm using go blocks, which spin off logical threads not real ones, so not sure I have control over that


I guess it depends on what you mean by “loops forever”; if you have something like “sleep for 5 minutes then run some house keeping job, and I don’t want this to stop the program from shutting down”, then I’m recommending not using a go block (or anything related to core.async), and instead just use a regular old java thread put into daemon mode


@tanzoniteblack sadly no, it's more like "poll this high-throuput SQS endpoint"


and what’s the termination condition on the program? I.e. does it quit when some other function has finished running, or does it only ever get killed when you manually kill it?


manually, it's a web server basically


or say a worker polling on a queue


then no, you don’t need to register a JVM shutDownHook; when you manually kill the JVM to kill the server, the JVM will clean up threads it created, like the threads running go-blocks


(the JVM won’t necessarily clean up other processes, but you’re almost certainly not creating any of those with go blocks and SQS polls)

Alex Miller (Clojure team)20:09:05

I released a new core.async version today - 0.2.389, no major changes mostly just to get a fix for the bounded-count warning with Clojure 1.9 out there