Quote (PumblesMumbles @ Jul 24 2012 06:33pm)
Hard to say with as little as you've posted but basically:
To do method1 without multithreading, you'd just make a function that reads the .txt and generates a single customer, and then call that method from a loop of some sort for each .txt file.
To do method1 with multithreading, you might implement a FutureTask that is constructed with a filename, reads that file and produces a Customer during execution, and results in a Customer object. Then you could spawn many of these futures and collect the results when they've completed.
This is just theorycraft; if you want something more concrete I'd need more detail.
Yeah I guess my question is more theory based.
My code is supposed to be able to run a single thread (taking in multiple .txt files such as file1.txt up to file2000.txt) and output a summary of each order and total summary of all orders to a designated .txt file.
It's also supposed to be able to use multithreading so that one thread is created for each order to be processed.
Classes:
Manager -
http://pastebin.com/n2bFwNmhCustomer -
http://pastebin.com/zT8j1CYiItem -
http://pastebin.com/r8kYtaS1I just feel as though the only aspect of my code that would improve in respect to run-time efficiency when using multi threading vs a single thread is when reading in the .txt files.
Other than that most of my output code is completed in one go once all the orders are read in.
This post was edited by lopelurag on Jul 24 2012 05:05pm