Skip to content

Commit

Permalink
fix: shutdown nacos client when discovery destroy (#4471)
Browse files Browse the repository at this point in the history
Co-authored-by: ZhangJian He <[email protected]>
  • Loading branch information
karsonto and shoothzj authored Aug 16, 2024
1 parent 356f8b0 commit e676df9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;

import com.alibaba.nacos.api.exception.NacosException;
import org.apache.servicecomb.registry.api.Discovery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
Expand Down Expand Up @@ -137,7 +138,13 @@ public void run() {

@Override
public void destroy() {

if (namingService != null) {
try {
namingService.shutDown();
} catch (NacosException e) {
throw new IllegalStateException("destroy process is interrupted.");
}
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public void destroy() {
try {
namingService.deregisterInstance(nacosRegistrationInstance.getServiceName(),
nacosRegistrationInstance.getApplication(), instance);
namingService.shutDown();
} catch (NacosException e) {
throw new IllegalStateException("destroy process is interrupted.");
}
Expand Down

0 comments on commit e676df9

Please sign in to comment.