|
|
@@ -87,20 +87,22 @@ public class AliBridgeServer extends AbstractClusterUniqueTask<AliBridgeServer>
|
|
|
}
|
|
|
|
|
|
public Mono<AliBridgeServer> initBridge(AliIotBridgeEntity params,boolean broadcast){
|
|
|
- verify(params);
|
|
|
- this.params=params;
|
|
|
- refreshBridgeConfig(params);
|
|
|
- params.setDeviceName(bridgeConfigManager.getDeviceName());
|
|
|
- if(bootstrap!=null){
|
|
|
- try {
|
|
|
- bootstrap.disconnectBridge();
|
|
|
- }catch (Exception e){}
|
|
|
- start.set(false);
|
|
|
- }
|
|
|
- bootstrap=new DefaultBridgeBootstrap(params.getId(),bridgeConfigManager);
|
|
|
- if(broadcast){
|
|
|
- //发送广播消息
|
|
|
- getClusterOperationTopic().publish(Mono.just(OperationMessage.builder().param(params).init(true).build())).subscribe();
|
|
|
+ //参数发生改变,更新bootstrap
|
|
|
+ if(!this.params.equals(params)){
|
|
|
+ verify(params);
|
|
|
+ this.params=params;
|
|
|
+ refreshBridgeConfig(params);
|
|
|
+ if(broadcast){
|
|
|
+ //发送广播消息
|
|
|
+ getClusterOperationTopic().publish(Mono.just(OperationMessage.builder().param(params).init(true).build())).subscribe();
|
|
|
+ }
|
|
|
+ if(bootstrap!=null){
|
|
|
+ try {
|
|
|
+ bootstrap.disconnectBridge();
|
|
|
+ }catch (Exception e){}
|
|
|
+ start.set(false);
|
|
|
+ }
|
|
|
+ bootstrap=new DefaultBridgeBootstrap(params.getId(),bridgeConfigManager);
|
|
|
}
|
|
|
//非主节点、非运行状态、已启动
|
|
|
if(isReplica()||(!BridgeStatus.running.equals(params.getState())&&!BridgeStatus.starting.equals(params.getState()))||start.get()){
|
|
|
@@ -141,9 +143,6 @@ public class AliBridgeServer extends AbstractClusterUniqueTask<AliBridgeServer>
|
|
|
}
|
|
|
|
|
|
public Mono<AliBridgeServer> refreshBootStrap(AliIotBridgeEntity params,boolean broadcast){
|
|
|
- if(this.params.equals(params)&&this.bootstrap!=null){
|
|
|
- return Mono.just(this);
|
|
|
- }
|
|
|
if (this.bootstrap!=null) {
|
|
|
try {
|
|
|
this.bootstrap.disconnectBridge();
|