Fork me on GitHub
#java
<
2023-12-27
>
Nim Sadeh02:12:51

I am a little unfamiliar with Java, trying to chase a resource leak in a data ingest daemon I wrote in Clojure. I have a bunch of go-blocks reading files using https://docs.oracle.com/javase/8/docs/api/java/io/FileInputStream.html. They don't explicitly call close() on the stream. However, they delete the file after the stream is read into an AWS bucket. Do I need to call close explicitly on a stream after I am done with it?

hiredman03:12:24

Also you should not be doing blocking io like reading a file in go blocks

Nim Sadeh04:12:18

How should I read files in clojure then?

hiredman04:12:07

Not in a go block

Nim Sadeh04:12:54

In this case I want to have a number of processes (in the concurrency sense, not actual separate PIDs) listening on downloads coming on a conveyor belt/channel, unzip the zip files, and upload a subset of those files to AWS. How would I accomplish that outside of go blocks?

hiredman04:12:55

I guess I don't understand, are you just not familiar with threads?

hiredman04:12:31

Go blocks are not threads, they are a series of callbacks attached to channels and then executed on a fixed size threadpool

Nim Sadeh04:12:56

Got it - I should use threads here?

Nim Sadeh04:12:48

I have mostly used actor concurrency so I default to trying to replicate it where I shouldn't, thanks for the nudge.

hiredman04:12:32

There is a #C05423W6H channel, you can search it for things like "blocking io" (not sure how useful the results are though)