I have the following code, which is used to watch a directory and on a creation of a file a
thread starts, it should read a CSV file and save the values of it in an object, after that I use the data saved in the object to sort the data from the CSV file in new directory depending on some strategies defined in a config.proprties file, when I paste some files in the directory that is being watched, it gets processed one after another, but what I want is to make them run at the same time unless I have more than one file that will use the same strategy can someone advice what am I doing wrong?
Here is my Watcher class:
And here is the class that used to read the property file and match it with file that have been created:
And here is my strategy implementation class:
When I run the code I get the following result:
Thread Name = Thread-2
Thread Name = Thread-2
Thread Name = Thread-2
Thread Name = Thread-2
Thread Name = Thread-2
Thread Name = Thread-5
Thread Name = Thread-5
Thread Name = Thread-5
Thread Name = Thread-5
Thread Name = Thread-5
Thread Name = Thread-4
Thread Name = Thread-4
Thread Name = Thread-4
Thread Name = Thread-4
Thread Name = Thread-4
Thread Name = Thread-3
Thread Name = Thread-3
Thread Name = Thread-3
Thread Name = Thread-3
Thread Name = Thread-3