Unverified Commit bf3cc0d0 authored by tswstarplanet's avatar tswstarplanet Committed by GitHub
Browse files

[Bug][Refactor][issue-3157]use cas to avoid thread safe problem (#3158)



Co-authored-by: default avatarlgcareer <18610854716@163.com>
parent d4d6aded
Loading
Loading
Loading
Loading
+32 −37
Original line number Diff line number Diff line
@@ -119,11 +119,7 @@ public class NettyRemotingServer {
     *  server start
     */
    public void start(){

        if(this.isStarted.get()){
            return;
        }

        if (isStarted.compareAndSet(false, true)) {
            this.serverBootstrap
                    .group(this.bossGroup, this.workGroup)
                    .channel(NioServerSocketChannel.class)
@@ -155,8 +151,7 @@ public class NettyRemotingServer {
            } else {
                throw new RuntimeException(String.format("NettyRemotingServer bind %s fail", serverConfig.getListenPort()));
            }
        //
        isStarted.compareAndSet(false, true);
        }
    }

    /**