Skip to content

Commit

Permalink
[ISSUE#2859]fix no throw exception when publish event but no subscibe…
Browse files Browse the repository at this point in the history
…r. (alibaba#3364)
  • Loading branch information
zongtanghu authored Jul 17, 2020
1 parent ff929b7 commit 9f12f76
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 130 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
import com.alibaba.nacos.api.PropertyKeyConst;
import com.alibaba.nacos.api.SystemPropertyKeyConst;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.client.config.impl.EventDispatcher.ServerlistChangeEvent;
import com.alibaba.nacos.client.config.impl.HttpSimpleClient.HttpResult;
import com.alibaba.nacos.client.utils.EnvUtil;
import com.alibaba.nacos.client.utils.LogUtils;
import com.alibaba.nacos.client.utils.ParamUtil;
import com.alibaba.nacos.client.utils.TemplateUtils;
import com.alibaba.nacos.common.lifecycle.Closeable;
import com.alibaba.nacos.common.notify.NotifyCenter;
import com.alibaba.nacos.common.utils.IoUtils;
import com.alibaba.nacos.common.utils.StringUtils;
import com.alibaba.nacos.common.utils.ThreadUtils;
Expand Down Expand Up @@ -335,7 +335,8 @@ private void updateIfChanged(List<String> newList) {
iterator = iterator();
currentServerAddr = iterator.next();

EventDispatcher.fireEvent(new ServerlistChangeEvent());
// Using unified event processor, NotifyCenter
NotifyCenter.publishEvent(new ServerlistChangeEvent());
LOGGER.info("[{}] [update-serverlist] serverlist updated to {}", name, serverUrls);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.client.config.impl;

import com.alibaba.nacos.common.notify.SlowEvent;

/**
* Server List Change Event.
*
* @author zongtanghu
*/
public class ServerlistChangeEvent extends SlowEvent {
}

0 comments on commit 9f12f76

Please sign in to comment.