I have the below problem at hand:
I have to read a file and for each line in this file, I have to check whether it meets a certain criteria. If it meets the criteria, I have to parse it into JSON format and post it to a server.
The second part of this problem is the file gets rolled. (Yes, its a log file which gets rolled after a certain size threshold)
Now my design consists of an ExecutorService a pooled http client to make http calls and a list of futures to determine if all tasks executed. I init all of these in the Main class and pass them along to other classes as of now. These are static fields as per definition
I have designed two classes - One for reading the main log file, and another for reading the remaining part of a file incase the log is rolled.
Now the problematic part - I want to share the same threadpool, the http pool and the futures here. So should I make a singleton for this?
I had put this question on code review and the above question is based on the response if got. The original code and question is available here
Aucun commentaire:
Enregistrer un commentaire