Usecase: I have 50+ customers and each customers activity is recorded in a separate excel file. A new file per customer is added to a shared file system location every 5 mins.
On application startup I am starting a thread to query the customer records and start one thread per customer. Customers details are stored in a database table. Using executor service thread pool and submitting a task per customer.
Each of the customer thread reads the excel file and processes each row in excel concurrently using multithreading. Each customer thread spawns a thread for each row in the excel file. Customer thread waits for all the child to complete before exiting.
我想在客户执行者服务网中实现以下目标:
- Schedule a thread for each customer, which spawns threads for each row in the excel file and waits for all child threads to complete.
- Only one thread per customer must be running at any point of time
- Each run can take different amount of time based on number of entries in the excel.
主要挑战 我正面临的是,如何确保每个客户只有一对客户的透视。
增 编