Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
oxsean committed Nov 25, 2024
1 parent ac679e2 commit 38cf318
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public void unregister(Invoker<?> invoker) {
if (tree == null) {
return;
}

lock.writeLock().lock();
try {
tree.remove(mapping -> mapping.meta.getInvoker() == invoker);
Expand All @@ -193,6 +194,7 @@ public void destroy() {
if (tree == null) {
return;
}

lock.writeLock().lock();
try {
tree.clear();
Expand All @@ -202,6 +204,10 @@ public void destroy() {
}

public HandlerMeta lookup(HttpRequest request) {
if (tree == null) {
return null;
}

String stringPath = PathUtils.normalize(request.uri());
request.setAttribute(RestConstants.PATH_ATTRIBUTE, stringPath);
KeyString path = new KeyString(stringPath, restConfig.getCaseSensitiveMatchOrDefault());
Expand Down Expand Up @@ -365,6 +371,10 @@ private void handleNoMatch(HttpRequest request, List<RequestMapping> partialMatc

@Override
public boolean exists(String stringPath, String method) {
if (tree == null) {
return false;
}

KeyString path = new KeyString(stringPath, restConfig.getCaseSensitiveMatchOrDefault());
if (tryExists(path, method)) {
return true;
Expand Down

0 comments on commit 38cf318

Please sign in to comment.