Skip to content

Commit

Permalink
feat: listenrId=-1 表示从存活列表获取一个,目标是增加方便性,以提高效率
Browse files Browse the repository at this point in the history
  • Loading branch information
qxo committed Oct 29, 2023
1 parent e638b97 commit 18c2054
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ public static void unReg(AdviceListener listener) {
}
}

public static AdviceListener listener(long id) {
public static AdviceListener listener(final long id) {
if (id == -1 && advices.size() > 0) {
return advices.entrySet().iterator().next().getValue();
}
return advices.get(id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ AdviceListener getAdviceListenerWithId(CommandProcess process) {
if (listenerId != 0) {
AdviceListener listener = AdviceWeaver.listener(listenerId);
if (listener != null) {
if (listenerId == -1) {
process.echoTips("found listenerId: " + listener.id() + "\n");
}
return listener;
}
}
Expand Down

0 comments on commit 18c2054

Please sign in to comment.