groostav
04/09/2018, 10:15 PMmap and filter in mind when writing these but I couldn't find them, so i simply went with for-each loops. are these operators defined somewhere in kotlinx.coroutines already?
your right, but my LiveThreadFactory.create() stuff just adds to debugability, since it will wrap the ForkJoinPool (aka CommonPool on java7+) in some thread-renaming stuff. I played with the idea of aiming for something like launch(CommonPool + Renaming), but order-of-operations became an issue, and it also made for what I thought were odd lifecycles, so I just kept what is something of a convention already for me.
and while(true) to while(isActive) is an OK idea, but watchService actually throws something similar to ChannelIsClosedException when you call watchService.close(), so I've actually updated the above code to include a
try { while(true) send(take()) } catch(ex: CannotTakeException) { log.fine("watch service closed", ex) }