|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
*/
|
|
|
|
|
package org.apache.dubbo.metadata.store.redis;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
|
|
|
|
import org.apache.dubbo.common.URL;
|
|
|
|
|
import org.apache.dubbo.common.config.configcenter.ConfigItem;
|
|
|
|
|
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
|
|
|
@ -28,40 +29,17 @@ import org.apache.dubbo.metadata.MappingChangedEvent;
|
|
|
|
|
import org.apache.dubbo.metadata.MappingListener;
|
|
|
|
|
import org.apache.dubbo.metadata.MetadataInfo;
|
|
|
|
|
import org.apache.dubbo.metadata.ServiceNameMapping;
|
|
|
|
|
import org.apache.dubbo.metadata.report.identifier.BaseMetadataIdentifier;
|
|
|
|
|
import org.apache.dubbo.metadata.report.identifier.KeyTypeEnum;
|
|
|
|
|
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
|
|
|
|
|
import org.apache.dubbo.metadata.report.identifier.ServiceMetadataIdentifier;
|
|
|
|
|
import org.apache.dubbo.metadata.report.identifier.SubscriberMetadataIdentifier;
|
|
|
|
|
import org.apache.dubbo.metadata.report.identifier.*;
|
|
|
|
|
import org.apache.dubbo.metadata.report.support.AbstractMetadataReport;
|
|
|
|
|
import org.apache.dubbo.rpc.RpcException;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
|
|
|
|
import redis.clients.jedis.HostAndPort;
|
|
|
|
|
import redis.clients.jedis.Jedis;
|
|
|
|
|
import redis.clients.jedis.JedisCluster;
|
|
|
|
|
import redis.clients.jedis.JedisPool;
|
|
|
|
|
import redis.clients.jedis.JedisPoolConfig;
|
|
|
|
|
import redis.clients.jedis.JedisPubSub;
|
|
|
|
|
import redis.clients.jedis.Transaction;
|
|
|
|
|
import redis.clients.jedis.*;
|
|
|
|
|
import redis.clients.jedis.params.SetParams;
|
|
|
|
|
import redis.clients.jedis.util.JedisClusterCRC16;
|
|
|
|
|
|
|
|
|
|
import static org.apache.dubbo.common.constants.CommonConstants.CLUSTER_KEY;
|
|
|
|
|
import static org.apache.dubbo.common.constants.CommonConstants.CYCLE_REPORT_KEY;
|
|
|
|
|
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_TIMEOUT;
|
|
|
|
|
import static org.apache.dubbo.common.constants.CommonConstants.GROUP_CHAR_SEPARATOR;
|
|
|
|
|
import static org.apache.dubbo.common.constants.CommonConstants.QUEUES_KEY;
|
|
|
|
|
import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
|
|
|
|
import static org.apache.dubbo.common.constants.CommonConstants.*;
|
|
|
|
|
import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_RESPONSE;
|
|
|
|
|
import static org.apache.dubbo.metadata.MetadataConstants.META_DATA_STORE_TAG;
|
|
|
|
|
import static org.apache.dubbo.metadata.ServiceNameMapping.DEFAULT_MAPPING_GROUP;
|
|
|
|
@ -479,8 +457,9 @@ public class RedisMetadataReport extends AbstractMetadataReport {
|
|
|
|
|
logger.info("sub from redis:" + key + " message:" + msg);
|
|
|
|
|
String applicationNames = getMappingData(buildMappingKey(DEFAULT_MAPPING_GROUP), msg);
|
|
|
|
|
MappingChangedEvent mappingChangedEvent = new MappingChangedEvent(msg, getAppNames(applicationNames));
|
|
|
|
|
if (!listeners.get(msg).isEmpty()) {
|
|
|
|
|
for (MappingListener mappingListener : listeners.get(msg)) {
|
|
|
|
|
Set<MappingListener> mappingListeners = listeners.get(msg);
|
|
|
|
|
if (mappingListeners != null && !mappingListeners.isEmpty()) {
|
|
|
|
|
for (MappingListener mappingListener : mappingListeners) {
|
|
|
|
|
mappingListener.onEvent(mappingChangedEvent);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|