So I am trying to delete n files from the disk which are listed in listDir and thereby I divided the listDir in 4 parts and let it to be deleted in parallel from the disk. The intention here is to do it in parallel so as to make it fast rather than sequential. deleteObject(x,credential,token) can be assumed as an API which finally deletes an object from the disk and is an atomic operation. It returns true on successful delete and false otherwise

I have few question here 

1. So as I have 4 parallel method which I am executing though invokeAll
and there are 4 threads declared by Executors.newFixedThreadPool(4)
would there always be 1 thread be assigned to 1 method?
2. Do I need to synchronize and use volatile for iterator 'i' in the for loop of parallelDeleteOperation() method. The reason I am asking this is supposing if 1st thread has not completed its task (deleting listDir1 and the for loop has not completed) and supposing in midway it got context switch and 2nd thread starts executing the same task(deleting listDir1). Just wondering if 2nd thread can get IndexOutOfBound exception in this case.
3. Is there any advantage of dividing list in 4 parts and executing this rather than having multiple threads executing delete operation on a very big list.
4. If one of the operation of ExecutorService returns false then on the whole deleteMain() API would return false 

```
 private boolean deleteMain(String parent, List<Structure>
    listDir, String place, String node, Sequence<String>
                               groups, String Uid) throws IOException {

int noCores = Runtime.getRuntime().availableProcessors();
List<List<Integer>> splittedList = splitList(listDir, noCores);

System.out.println(splittedList.size());

System.out.println("NoOfCores" + noCores);
Set<Callable<Boolean>> callables = new HashSet<Callable<Boolean>>();
for (int i = 0; i < splittedList.size(); i++) {
    List<Integer> l = splittedList.get(i);
    callables.add(new Callable<Boolean>() {
        @Override
        public Boolean call() throws Exception {

            return parallelDeleteOperation(parent, listDir, place, node, groups Uid);
        }
    });
}

ExecutorService service = Executors.newFixedThreadPool(noCores);

try {
    List<Future<Boolean>> futures = service.invokeAll(callables);

    for (Future<Boolean> future : futures) {
        if (future.get() != true)
            return future.get();
    }
} catch (InterruptedException e) {
    e.printStackTrace();
} catch (ExecutionException e) {
    e.printStackTrace();
}
service.shutdown();
return true;
}

private Boolean parallelDeleteOperation(String parent, List<Structure>
    listDir, String place, String node, Sequence<String>
                                            groups, String Uid) throws IOException {
for (int i = 0; i < listDir.size(); i++) {
    final String name = listDir.get(i).filename;

    final String filePath = "/" + (parent.isEmpty() ? "" : (parent +
            "/")) + name;
    final DeleteMessage message = new DeleteMessage(name, place, node
            filePath);
    final boolean Status = delete(message, groups, Uid, place);
    if (Status != true)
        return Status;
}
return true;
}

```