I have a List named people that gets update every 72 hours, I also have a Controller that returns this list:

```
@GetMapping
public ResponseEntity<List<String>> getPeople() {
    List<String> people = peopleService.getPeople();
    return ResponseEntity.ok(people);
}

```

I'm afraid that there will be times where I return a partial list because at the same time I'm doing an update to the list in the service, something like this:

```
people = getPeople();

```

I also get a call from the controller and I should return this list that sometimes get updated so it's kind of related to multithreading.

I was thinking about a boolean variable named isProcessing that wll be like that:

```
isProcessing = true;
people = getPeople();
isProcessing = false;

```

What do you think, maybe there is other way to solve the problem? Thanks.

Edit: 
I use the spring scheduler annotation to update the list every 72 hours, I don't update the list in another scenarios.
I'm not using a database, I have a call to an API, I get Json, and I start a calculation and in the end I collect all the names I need to a list and put this list inside people so the people list get update every 72 hours.

As @Cargeh said, I'm afraid of this situation:
**"you start a read, myList is pointing to List#1. You keep reading it. In the mean time, update occurs and sets myList to List#2 (newList here), while you keep reading List#1.**