This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/develop by this push:
     new a9210197d refactor: replace deprecated CAS with CompareAndSwap (#2962)
a9210197d is described below

commit a9210197d5b3fd40362562d0c7f1ab07f36bfde7
Author: 1kasa <[email protected]>
AuthorDate: Sun Aug 3 23:13:21 2025 +0800

    refactor: replace deprecated CAS with CompareAndSwap (#2962)
    
    * replace deprecated CAS with CompareAndSwap
    
    * replace deprecated CAS with CompareAndSwap
    
    * update branch
    
    * update branch
---
 cluster/cluster/base/cluster_invoker.go | 2 +-
 cluster/directory/base/directory.go     | 2 +-
 registry/mock_registry.go               | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cluster/cluster/base/cluster_invoker.go 
b/cluster/cluster/base/cluster_invoker.go
index 5bddde5c6..c93db6ddf 100644
--- a/cluster/cluster/base/cluster_invoker.go
+++ b/cluster/cluster/base/cluster_invoker.go
@@ -56,7 +56,7 @@ func (invoker *BaseClusterInvoker) GetURL() *common.URL {
 
 func (invoker *BaseClusterInvoker) Destroy() {
        // this is must atom operation
-       if invoker.Destroyed.CAS(false, true) {
+       if invoker.Destroyed.CompareAndSwap(false, true) {
                invoker.Directory.Destroy()
        }
 }
diff --git a/cluster/directory/base/directory.go 
b/cluster/directory/base/directory.go
index 38812b94c..388e5fb09 100644
--- a/cluster/directory/base/directory.go
+++ b/cluster/directory/base/directory.go
@@ -93,7 +93,7 @@ func (dir *Directory) isProperRouter(url *common.URL) bool {
 
 // DoDestroy stop directory
 func (dir *Directory) DoDestroy(doDestroy func()) {
-       if dir.destroyed.CAS(false, true) {
+       if dir.destroyed.CompareAndSwap(false, true) {
                dir.mutex.Lock()
                doDestroy()
                dir.mutex.Unlock()
diff --git a/registry/mock_registry.go b/registry/mock_registry.go
index 5407dc681..28c2805ad 100644
--- a/registry/mock_registry.go
+++ b/registry/mock_registry.go
@@ -62,7 +62,7 @@ func (r *MockRegistry) UnRegister(conf *common.URL) error {
 
 // nolint
 func (r *MockRegistry) Destroy() {
-       if r.destroyed.CAS(false, true) {
+       if r.destroyed.CompareAndSwap(false, true) {
        }
 }
 

Reply via email to