Skip to content

parallel().forEach() is not working properly. #117

@Karthick-Shanmugam-15

Description

@Karthick-Shanmugam-15

i am uploading excel file with record count of 10K. when i use foreach, its working properly. but when i try to use parallel.forEach(), its not read all the values from excel.

the following code is not reading all the data from excel. its so inconsistent.

try (InputStream is =new FileInputStream(new File(fileLocation));  ReadableWorkbook wb = new ReadableWorkbook(is)) {
			Sheet sheet = wb.getFirstSheet();
``				try (Stream<Row> rows = sheet.openStream()) {
					rows.skip(2).parallel().forEach(r -> {
						BigDecimal bDec = r.getCellAsNumber(0).orElse(null);
						if(bDec!=null)
							obj.add(bDec.intValue());
					});
				}		
		}

Please correct me if i am doing anything wrongly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions