Skip to content

Commit

Permalink
optimize getBiz method by reduce invoke Map.toArray() (#1286) (#1287)
Browse files Browse the repository at this point in the history
  • Loading branch information
NTP1996 authored Feb 20, 2024
1 parent c050784 commit 3502092
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,8 @@ public static Biz getBiz(SofaRuntimeManager sofaRuntimeManager) {
if (getInstance().bizManagerService == null) {
return null;
}

for (Biz biz : getInstance().bizManagerService.getBizInOrder()) {
if (biz.getBizClassLoader().equals(sofaRuntimeManager.getAppClassLoader())) {
return biz;
}
}
return null;
return getInstance().bizManagerService.getBizByClassLoader(sofaRuntimeManager
.getAppClassLoader());
}

public boolean isHasFinishStartup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public Biz getBizByIdentity(String s) {

@Override
public Biz getBizByClassLoader(ClassLoader classLoader) {
for (Biz biz : bizList) {
if (biz.getBizClassLoader().equals(classLoader)) {
return biz;
}
}
return null;
}

Expand Down

0 comments on commit 3502092

Please sign in to comment.