Skip to content

Commit

Permalink
Deep copy the tenants to avoid concurrent sort exception (apache#11463)
Browse files Browse the repository at this point in the history
  • Loading branch information
hezhangjian authored Jul 29, 2021
1 parent 026eac8 commit 191dc62
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -76,8 +77,10 @@ public void getTenants(@Suspended final AsyncResponse asyncResponse) {
asyncResponse.resume(new RestException(e));
return;
}
tenants.sort(null);
asyncResponse.resume(tenants);
// deep copy the tenants to avoid concurrent sort exception
List<String> deepCopy = new ArrayList<>(tenants);
deepCopy.sort(null);
asyncResponse.resume(deepCopy);
});
}

Expand Down

0 comments on commit 191dc62

Please sign in to comment.