Displaying differences for changeset |
@@ -26,6 +26,11 @@ |
if (args.length >= 1) { |
boolean fileDone = false; |
int lineNumber = 0; |
+ int maxThreads = 10; |
+ |
+ if (args.length >= 2) { |
+ maxThreads = Integer.parseInt(args[1]); |
+ } |
File inputFile = new File(args[0]); |
BufferedReader inputStream = Files.newBufferedReader(inputFile.toPath()); |
@@ -33,9 +38,9 @@ |
while (!fileDone) { |
int count = 0; |
- while ((count < 10) && (!fileDone)) { |
+ while ((count < maxThreads) && (!fileDone)) { |
String inLine = inputStream.readLine(); |
- |
+ |
if (null != inLine) { |
lineNumber++; |
String[] latLon = inLine.split(","); |
@@ -55,10 +60,10 @@ |
ServiceCallThread tServiceCall = new ServiceCallThread(coordinates[i][0], coordinates[i][1], latch); |
tServiceCall.start(); |
} |
- |
+ |
latch.await(); |
} |
- }else{ |
+ } else { |
System.err.println("Please specify an input file"); |
} |
} |