Merge branch 'apache-3.2' into apache-3.3

# Conflicts:
#	dubbo-container/dubbo-container-api/src/main/java/org/apache/dubbo/container/Main.java
#	dubbo-dependencies-bom/pom.xml
#	dubbo-distribution/dubbo-apache-release/pom.xml
#	dubbo-monitor/dubbo-monitor-api/src/main/java/org/apache/dubbo/monitor/support/AbstractMonitorFactory.java
#	dubbo-remoting/dubbo-remoting-http12/pom.xml
#	dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/AbstractServerCallListener.java
#	dubbo-spring-boot/pom.xml
#	dubbo-test/dubbo-test-spring/pom.xml
This commit is contained in:
Albumen Kevin 2024-04-10 13:15:14 +08:00
commit 53553dcef4
119 changed files with 442 additions and 398 deletions

View File

@ -212,7 +212,7 @@ public class SingleRouterChain<T> {
public RouterSnapshotNode<T> buildRouterSnapshot(
URL url, BitList<Invoker<T>> availableInvokers, Invocation invocation) {
BitList<Invoker<T>> resultInvokers = availableInvokers.clone();
RouterSnapshotNode<T> parentNode = new RouterSnapshotNode<T>("Parent", resultInvokers.clone());
RouterSnapshotNode<T> parentNode = new RouterSnapshotNode<>("Parent", resultInvokers.clone());
parentNode.setNodeOutputInvokers(resultInvokers.clone());
// 1. route state router
@ -227,7 +227,7 @@ public class SingleRouterChain<T> {
return parentNode;
}
RouterSnapshotNode<T> commonRouterNode = new RouterSnapshotNode<T>("CommonRouter", resultInvokers.clone());
RouterSnapshotNode<T> commonRouterNode = new RouterSnapshotNode<>("CommonRouter", resultInvokers.clone());
parentNode.appendNode(commonRouterNode);
List<Invoker<T>> commonRouterResult = resultInvokers;
@ -237,7 +237,7 @@ public class SingleRouterChain<T> {
List<Invoker<T>> inputInvokers = new ArrayList<>(commonRouterResult);
RouterSnapshotNode<T> currentNode =
new RouterSnapshotNode<T>(router.getClass().getSimpleName(), inputInvokers);
new RouterSnapshotNode<>(router.getClass().getSimpleName(), inputInvokers);
// append to router node chain
commonRouterNode.appendNode(currentNode);

View File

@ -223,7 +223,7 @@ public abstract class AbstractConfigurator implements Configurator {
}
private Set<String> genConditionKeys() {
Set<String> conditionKeys = new HashSet<String>();
Set<String> conditionKeys = new HashSet<>();
conditionKeys.add(CATEGORY_KEY);
conditionKeys.add(Constants.CHECK_KEY);
conditionKeys.add(DYNAMIC_KEY);

View File

@ -46,8 +46,7 @@ public class ConsistentHashLoadBalance extends AbstractLoadBalance {
*/
public static final String HASH_ARGUMENTS = "hash.arguments";
private final ConcurrentMap<String, ConsistentHashSelector<?>> selectors =
new ConcurrentHashMap<String, ConsistentHashSelector<?>>();
private final ConcurrentMap<String, ConsistentHashSelector<?>> selectors = new ConcurrentHashMap<>();
@SuppressWarnings("unchecked")
@Override
@ -75,7 +74,7 @@ public class ConsistentHashLoadBalance extends AbstractLoadBalance {
private final int[] argumentIndex;
ConsistentHashSelector(List<Invoker<T>> invokers, String methodName, int identityHashCode) {
this.virtualInvokers = new TreeMap<Long, Invoker<T>>();
this.virtualInvokers = new TreeMap<>();
this.identityHashCode = identityHashCode;
URL url = invokers.get(0).getUrl();
this.replicaNumber = url.getMethodParameter(methodName, HASH_NODES, 160);

View File

@ -32,7 +32,7 @@ public class MapMerger implements Merger<Map<?, ?>> {
if (ArrayUtils.isEmpty(items)) {
return Collections.emptyMap();
}
Map<Object, Object> result = new HashMap<Object, Object>();
Map<Object, Object> result = new HashMap<>();
Stream.of(items).filter(Objects::nonNull).forEach(result::putAll);
return result;
}

View File

@ -36,7 +36,7 @@ public class MergerFactory implements ScopeModelAware {
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(MergerFactory.class);
private ConcurrentMap<Class<?>, Merger<?>> MERGER_CACHE = new ConcurrentHashMap<Class<?>, Merger<?>>();
private ConcurrentMap<Class<?>, Merger<?>> MERGER_CACHE = new ConcurrentHashMap<>();
private ScopeModel scopeModel;
@Override

View File

@ -32,7 +32,7 @@ public class SetMerger implements Merger<Set<?>> {
if (ArrayUtils.isEmpty(items)) {
return Collections.emptySet();
}
Set<Object> result = new HashSet<Object>();
Set<Object> result = new HashSet<>();
Stream.of(items).filter(Objects::nonNull).forEach(result::addAll);
return result;
}

View File

@ -30,6 +30,6 @@ public class ConditionStateRouterFactory extends CacheableStateRouterFactory {
@Override
protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) {
return new ConditionStateRouter<T>(url);
return new ConditionStateRouter<>(url);
}
}

View File

@ -32,6 +32,6 @@ public class ServiceStateRouterFactory extends CacheableStateRouterFactory {
@Override
protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) {
return new ServiceStateRouter<T>(url);
return new ServiceStateRouter<>(url);
}
}

View File

@ -136,7 +136,7 @@ public class MeshRuleCache<T> {
Collections.unmodifiableMap(totalSubsetMap),
unmatchedInvokers);
} else {
return new MeshRuleCache<T>(
return new MeshRuleCache<>(
Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap(), invokers);
}
}

View File

@ -30,6 +30,6 @@ public class MockStateRouterFactory implements StateRouterFactory {
@Override
public <T> StateRouter<T> getRouter(Class<T> interfaceClass, URL url) {
return new MockInvokersSelector<T>(url);
return new MockInvokersSelector<>(url);
}
}

View File

@ -31,6 +31,6 @@ public class TagStateRouterFactory extends CacheableStateRouterFactory {
@Override
protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) {
return new TagStateRouter<T>(url);
return new TagStateRouter<>(url);
}
}

View File

@ -63,8 +63,8 @@ public class FailoverClusterInvoker<T> extends AbstractClusterInvoker<T> {
int len = calculateInvokeTimes(methodName);
// retry loop.
RpcException le = null; // last exception.
List<Invoker<T>> invoked = new ArrayList<Invoker<T>>(copyInvokers.size()); // invoked invokers.
Set<String> providers = new HashSet<String>(len);
List<Invoker<T>> invoked = new ArrayList<>(copyInvokers.size()); // invoked invokers.
Set<String> providers = new HashSet<>(len);
for (int i = 0; i < len; i++) {
// Reselect before retry to avoid a change of candidate `invokers`.
// NOTE: if `invokers` changed, then `invoked` also lose accuracy.

View File

@ -26,6 +26,6 @@ public class MergeableCluster extends AbstractCluster {
@Override
public <T> AbstractClusterInvoker<T> doJoin(Directory<T> directory) throws RpcException {
return new MergeableClusterInvoker<T>(directory);
return new MergeableClusterInvoker<>(directory);
}
}

View File

@ -27,6 +27,6 @@ public class ZoneAwareCluster extends AbstractCluster {
@Override
protected <T> AbstractClusterInvoker<T> doJoin(Directory<T> directory) throws RpcException {
return new ZoneAwareClusterInvoker<T>(directory);
return new ZoneAwareClusterInvoker<>(directory);
}
}

View File

@ -35,7 +35,7 @@ public class MockClusterWrapper implements Cluster {
@Override
public <T> Invoker<T> join(Directory<T> directory, boolean buildFilterChain) throws RpcException {
return new MockClusterInvoker<T>(directory, this.cluster.join(directory, buildFilterChain));
return new MockClusterInvoker<>(directory, this.cluster.join(directory, buildFilterChain));
}
public Cluster getCluster() {

View File

@ -60,7 +60,7 @@ public final class Version {
public static final int LOWEST_VERSION_FOR_RESPONSE_ATTACHMENT = 2000200; // 2.0.2
public static final int HIGHEST_PROTOCOL_VERSION = 2009900; // 2.0.99
private static final Map<String, Integer> VERSION2INT = new HashMap<String, Integer>();
private static final Map<String, Integer> VERSION2INT = new HashMap<>();
static {
// get dubbo version and last commit id

View File

@ -35,7 +35,7 @@ import java.util.Map;
public final class JavaBeanSerializeUtil {
private static final Logger logger = LoggerFactory.getLogger(JavaBeanSerializeUtil.class);
private static final Map<String, Class<?>> TYPES = new HashMap<String, Class<?>>();
private static final Map<String, Class<?>> TYPES = new HashMap<>();
private static final String ARRAY_PREFIX = "[";
private static final String REFERENCE_TYPE_PREFIX = "L";
private static final String REFERENCE_TYPE_SUFFIX = ";";
@ -72,7 +72,7 @@ public final class JavaBeanSerializeUtil {
if (obj instanceof JavaBeanDescriptor) {
return (JavaBeanDescriptor) obj;
}
IdentityHashMap<Object, JavaBeanDescriptor> cache = new IdentityHashMap<Object, JavaBeanDescriptor>();
IdentityHashMap<Object, JavaBeanDescriptor> cache = new IdentityHashMap<>();
return createDescriptorIfAbsent(obj, accessor, cache);
}
@ -209,7 +209,7 @@ public final class JavaBeanSerializeUtil {
if (beanDescriptor == null) {
return null;
}
IdentityHashMap<JavaBeanDescriptor, Object> cache = new IdentityHashMap<JavaBeanDescriptor, Object>();
IdentityHashMap<JavaBeanDescriptor, Object> cache = new IdentityHashMap<>();
Object result = instantiateForDeserialize(beanDescriptor, loader, cache);
deserializeInternal(result, beanDescriptor, loader, cache);
return result;

View File

@ -120,7 +120,7 @@ public abstract class Mixin {
Class<?> neighbor = null;
// impl methods.
Set<String> worked = new HashSet<String>();
Set<String> worked = new HashSet<>();
for (int i = 0; i < ics.length; i++) {
if (!Modifier.isPublic(ics[i].getModifiers())) {
String npkg = ics[i].getPackage().getName();

View File

@ -42,8 +42,8 @@ import javassist.CtMethod;
* Wrapper.
*/
public abstract class Wrapper {
private static final ConcurrentMap<Class<?>, Wrapper> WRAPPER_MAP =
new ConcurrentHashMap<Class<?>, Wrapper>(); // class wrapper map
// class wrapper map
private static final ConcurrentMap<Class<?>, Wrapper> WRAPPER_MAP = new ConcurrentHashMap<>();
private static final String[] EMPTY_STRING_ARRAY = new String[0];
private static final String[] OBJECT_METHODS = new String[] {"getClass", "hashCode", "toString", "equals"};
private static final Wrapper OBJECT_WRAPPER = new Wrapper() {

View File

@ -392,7 +392,7 @@ public class ClassUtils {
}
public static <K, V> Map<K, V> toMap(Map.Entry<K, V>[] entries) {
Map<K, V> map = new HashMap<K, V>();
Map<K, V> map = new HashMap<>();
if (entries != null && entries.length > 0) {
for (Map.Entry<K, V> entry : entries) {
map.put(entry.getKey(), entry.getValue());

View File

@ -28,7 +28,7 @@ public final class InternalThreadLocalMap {
private Object[] indexedVariables;
private static ThreadLocal<InternalThreadLocalMap> slowThreadLocalMap = new ThreadLocal<InternalThreadLocalMap>();
private static ThreadLocal<InternalThreadLocalMap> slowThreadLocalMap = new ThreadLocal<>();
private static final AtomicInteger NEXT_INDEX = new AtomicInteger();

View File

@ -428,7 +428,7 @@ public class HashedWheelTimer implements Timer {
}
private final class Worker implements Runnable {
private final Set<Timeout> unprocessedTimeouts = new HashSet<Timeout>();
private final Set<Timeout> unprocessedTimeouts = new HashSet<>();
private long tick;

View File

@ -98,7 +98,7 @@ public class CIDRUtils {
private byte[] toBytes(byte[] array, int targetSize) {
int counter = 0;
List<Byte> newArr = new ArrayList<Byte>();
List<Byte> newArr = new ArrayList<>();
while (counter < targetSize && (array.length - 1 - counter >= 0)) {
newArr.add(0, array[array.length - 1 - counter]);
counter++;

View File

@ -87,7 +87,7 @@ public class ConfigUtils {
*/
public static List<String> mergeValues(
ExtensionDirector extensionDirector, Class<?> type, String cfg, List<String> def) {
List<String> defaults = new ArrayList<String>();
List<String> defaults = new ArrayList<>();
if (def != null) {
for (String name : def) {
if (extensionDirector.getExtensionLoader(type).hasExtension(name)) {
@ -96,7 +96,7 @@ public class ConfigUtils {
}
}
List<String> names = new ArrayList<String>();
List<String> names = new ArrayList<>();
// add initial values
String[] configs = (cfg == null || cfg.trim().length() == 0) ? new String[0] : COMMA_SPLIT_PATTERN.split(cfg);

View File

@ -179,7 +179,7 @@ public class IOUtils {
* @throws IOException If an I/O error occurs
*/
public static String[] readLines(InputStream is) throws IOException {
List<String> lines = new ArrayList<String>();
List<String> lines = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
String line;
while ((line = reader.readLine()) != null) {

View File

@ -26,7 +26,7 @@ import java.util.List;
public class Stack<E> {
private int mSize = 0;
private final List<E> mElements = new ArrayList<E>();
private final List<E> mElements = new ArrayList<>();
public Stack() {}

View File

@ -878,7 +878,7 @@ public final class StringUtils {
*/
private static Map<String, String> parseKeyValuePair(String str, String itemSeparator) {
String[] tmp = str.split(itemSeparator);
Map<String, String> map = new HashMap<String, String>(tmp.length);
Map<String, String> map = new HashMap<>(tmp.length);
for (int i = 0; i < tmp.length; i++) {
Matcher matcher = KVP_PATTERN.matcher(tmp[i]);
if (!matcher.matches()) {
@ -902,7 +902,7 @@ public final class StringUtils {
*/
public static Map<String, String> parseQueryString(String qs) {
if (isEmpty(qs)) {
return new HashMap<String, String>();
return new HashMap<>();
}
return parseKeyValuePair(qs, "\\&");
}

View File

@ -181,7 +181,7 @@ public class UrlUtils {
throw new IllegalArgumentException(
"Addresses is not allowed to be empty, please re-enter."); // here won't be empty
}
List<URL> registries = new ArrayList<URL>();
List<URL> registries = new ArrayList<>();
for (String addr : addresses) {
registries.add(parseURL(addr, defaults));
}

View File

@ -221,7 +221,7 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
/**
* The url of the reference service
*/
protected final transient List<URL> urls = new ArrayList<URL>();
protected final transient List<URL> urls = new ArrayList<>();
@Transient
public List<URL> getExportedUrls() {

View File

@ -186,7 +186,7 @@ public class ModuleConfig extends AbstractConfig {
}
public void setRegistry(RegistryConfig registry) {
List<RegistryConfig> registries = new ArrayList<RegistryConfig>(1);
List<RegistryConfig> registries = new ArrayList<>(1);
registries.add(registry);
this.registries = registries;
}

View File

@ -96,7 +96,7 @@ public final class ClassUtils {
* @return methods list
*/
public static List<Method> getPublicNonStaticMethods(final Class<?> clazz) {
List<Method> result = new ArrayList<Method>();
List<Method> result = new ArrayList<>();
Method[] methods = clazz.getMethods();
for (Method method : methods) {

View File

@ -135,7 +135,7 @@ public class ProviderModel extends ServiceModel {
}
public List<ProviderMethodModel> getAllMethodModels() {
List<ProviderMethodModel> result = new ArrayList<ProviderMethodModel>();
List<ProviderMethodModel> result = new ArrayList<>();
for (List<ProviderMethodModel> models : methods.values()) {
result.addAll(models);
}

View File

@ -30,7 +30,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.METHOD_KEY;
@Deprecated
public abstract class AbstractCacheFactory implements CacheFactory {
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>();
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<>();
@Override
public Cache getCache(URL url, Invocation invocation) {

View File

@ -86,7 +86,7 @@ public class ServiceConfig<T> extends org.apache.dubbo.config.ServiceConfig<T> {
if (providers == null || providers.isEmpty()) {
return null;
}
List<ProtocolConfig> protocols = new ArrayList<ProtocolConfig>(providers.size());
List<ProtocolConfig> protocols = new ArrayList<>(providers.size());
for (ProviderConfig provider : providers) {
protocols.add(convertProviderToProtocol(provider));
}

View File

@ -57,8 +57,8 @@ public class Page {
}
private static List<List<String>> stringToList(String str) {
List<List<String>> rows = new ArrayList<List<String>>();
List<String> row = new ArrayList<String>();
List<List<String>> rows = new ArrayList<>();
List<String> row = new ArrayList<>();
row.add(str);
rows.add(row);
return rows;

View File

@ -49,8 +49,8 @@ public class PageServlet extends HttpServlet {
private static final long serialVersionUID = -8370312705453328501L;
private static PageServlet INSTANCE;
protected final Random random = new Random();
protected final Map<String, PageHandler> pages = new ConcurrentHashMap<String, PageHandler>();
protected final List<PageHandler> menus = new ArrayList<PageHandler>();
protected final Map<String, PageHandler> pages = new ConcurrentHashMap<>();
protected final List<PageHandler> menus = new ArrayList<>();
public static PageServlet getInstance() {
return INSTANCE;

View File

@ -46,7 +46,7 @@ public class ResourceFilter implements Filter {
private final long start = System.currentTimeMillis();
private final List<String> resources = new ArrayList<String>();
private final List<String> resources = new ArrayList<>();
public void init(FilterConfig filterConfig) throws ServletException {
String config = filterConfig.getInitParameter("resources");

View File

@ -35,11 +35,11 @@ public class HomePageHandler implements PageHandler {
@Override
public Page handle(URL url) {
List<List<String>> rows = new ArrayList<List<String>>();
List<List<String>> rows = new ArrayList<>();
for (PageHandler handler : PageServlet.getInstance().getMenus()) {
String uri = ExtensionLoader.getExtensionLoader(PageHandler.class).getExtensionName(handler);
Menu menu = handler.getClass().getAnnotation(Menu.class);
List<String> row = new ArrayList<String>();
List<String> row = new ArrayList<>();
row.add("<a href=\"" + uri + ".html\">" + menu.name() + "</a>");
row.add(menu.desc());
rows.add(row);

View File

@ -97,8 +97,8 @@ public class LogPageHandler implements PageHandler {
}
}
Level level = LogManager.getRootLogger().getLevel();
List<List<String>> rows = new ArrayList<List<String>>();
List<String> row = new ArrayList<String>();
List<List<String>> rows = new ArrayList<>();
List<String> row = new ArrayList<>();
row.add(content);
rows.add(row);
return new Page(

View File

@ -40,14 +40,14 @@ public class StatusPageHandler implements PageHandler {
@Override
public Page handle(URL url) {
List<List<String>> rows = new ArrayList<List<String>>();
List<List<String>> rows = new ArrayList<>();
Set<String> names =
ExtensionLoader.getExtensionLoader(StatusChecker.class).getSupportedExtensions();
Map<String, Status> statuses = new HashMap<String, Status>();
Map<String, Status> statuses = new HashMap<>();
for (String name : names) {
StatusChecker checker =
ExtensionLoader.getExtensionLoader(StatusChecker.class).getExtension(name);
List<String> row = new ArrayList<String>();
List<String> row = new ArrayList<>();
row.add(name);
Status status = checker.check();
if (status != null && !Status.Level.UNKNOWN.equals(status.getLevel())) {
@ -61,7 +61,7 @@ public class StatusPageHandler implements PageHandler {
if ("status".equals(url.getPath())) {
return new Page("", "", "", status.getLevel().toString());
} else {
List<String> row = new ArrayList<String>();
List<String> row = new ArrayList<>();
row.add("summary");
row.add(getLevelHtml(status.getLevel()));
row.add("<a href=\"/status\" target=\"_blank\">summary</a>");

View File

@ -46,27 +46,27 @@ public class SystemPageHandler implements PageHandler {
@Override
public Page handle(URL url) {
List<List<String>> rows = new ArrayList<List<String>>();
List<List<String>> rows = new ArrayList<>();
List<String> row;
row = new ArrayList<String>();
row = new ArrayList<>();
row.add("Version");
row.add(Version.getVersion(SystemPageHandler.class, "2.0.0"));
rows.add(row);
row = new ArrayList<String>();
row = new ArrayList<>();
row.add("Host");
String address = NetUtils.getLocalHost();
row.add(NetUtils.getHostName(address) + "/" + address);
rows.add(row);
row = new ArrayList<String>();
row = new ArrayList<>();
row.add("OS");
row.add(SystemPropertyConfigUtils.getSystemProperty(CommonConstants.SystemProperty.SYSTEM_OS_NAME) + " "
+ SystemPropertyConfigUtils.getSystemProperty(CommonConstants.SystemProperty.SYSTEM_OS_VERSION));
rows.add(row);
row = new ArrayList<String>();
row = new ArrayList<>();
row.add("JVM");
row.add(SystemPropertyConfigUtils.getSystemProperty(CommonConstants.SystemProperty.JAVA_RUNTIME_NAME) + " "
+ SystemPropertyConfigUtils.getSystemProperty(CommonConstants.SystemProperty.JAVA_RUNTIME_VERSION)
@ -76,24 +76,24 @@ public class SystemPageHandler implements PageHandler {
+ SystemPropertyConfigUtils.getSystemProperty(CommonConstants.SystemProperty.JAVA_VM_INFO, ""));
rows.add(row);
row = new ArrayList<String>();
row = new ArrayList<>();
row.add("CPU");
row.add(SystemPropertyConfigUtils.getSystemProperty(CommonConstants.SystemProperty.OS_ARCH, "") + ", "
+ String.valueOf(Runtime.getRuntime().availableProcessors()) + " cores");
rows.add(row);
row = new ArrayList<String>();
row = new ArrayList<>();
row.add("Locale");
row.add(Locale.getDefault().toString() + "/"
+ SystemPropertyConfigUtils.getSystemProperty(CommonConstants.SystemProperty.SYSTEM_FILE_ENCODING));
rows.add(row);
row = new ArrayList<String>();
row = new ArrayList<>();
row.add("Uptime");
row.add(formatUptime(ManagementFactory.getRuntimeMXBean().getUptime()));
rows.add(row);
row = new ArrayList<String>();
row = new ArrayList<>();
row.add("Time");
row.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS Z").format(new Date()));
rows.add(row);

View File

@ -353,7 +353,7 @@ public class RpcContext {
final T o = callable.call();
// local invoke will return directly
if (o != null) {
FutureTask<T> f = new FutureTask<T>(new Callable<T>() {
FutureTask<T> f = new FutureTask<>(new Callable<T>() {
@Override
public T call() throws Exception {
return o;

View File

@ -162,14 +162,14 @@ public class RpcInvocation implements Invocation, Serializable {
public void setAttachment(String key, String value) {
if (attachments == null) {
attachments = new HashMap<String, String>();
attachments = new HashMap<>();
}
attachments.put(key, value);
}
public void setAttachmentIfAbsent(String key, String value) {
if (attachments == null) {
attachments = new HashMap<String, String>();
attachments = new HashMap<>();
}
if (!attachments.containsKey(key)) {
attachments.put(key, value);
@ -181,7 +181,7 @@ public class RpcInvocation implements Invocation, Serializable {
return;
}
if (this.attachments == null) {
this.attachments = new HashMap<String, String>();
this.attachments = new HashMap<>();
}
this.attachments.putAll(attachments);
}

View File

@ -349,6 +349,7 @@ public class ReferenceConfig<T> extends ReferenceConfigBase<T> {
if (CommonConstants.NATIVE_STUB.equals(getProxy())) {
serviceDescriptor = StubSuppliers.getServiceDescriptor(interfaceName);
repository.registerService(serviceDescriptor);
setInterface(serviceDescriptor.getInterfaceName());
} else {
serviceDescriptor = repository.registerService(interfaceClass);
}

View File

@ -131,7 +131,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
/**
* A random port cache, the different protocols who have no port specified have different random port
*/
private static final Map<String, Integer> RANDOM_PORT_MAP = new HashMap<String, Integer>();
private static final Map<String, Integer> RANDOM_PORT_MAP = new HashMap<>();
private Protocol protocolSPI;
@ -671,7 +671,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
private Map<String, String> buildAttributes(ProtocolConfig protocolConfig) {
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put(SIDE_KEY, PROVIDER_SIDE);
// append params with basic configs,

View File

@ -210,7 +210,7 @@ public class ConfigValidationUtils {
address = ANYHOST_VALUE;
}
if (!RegistryConfig.NO_AVAILABLE.equalsIgnoreCase(address)) {
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
AbstractConfig.appendParameters(map, application);
AbstractConfig.appendParameters(map, config);
map.put(PATH_KEY, RegistryService.class.getName());
@ -313,7 +313,7 @@ public class ConfigValidationUtils {
}
public static URL loadMonitor(AbstractInterfaceConfig interfaceConfig, URL registryURL) {
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put(INTERFACE_KEY, MonitorService.class.getName());
AbstractInterfaceConfig.appendRuntimeParameters(map);
// set ip

View File

@ -74,7 +74,7 @@
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.21.2</version>
<version>1.9.22</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -78,8 +78,7 @@ public abstract class AbstractAnnotationBeanPostProcessor
private final Class<? extends Annotation>[] annotationTypes;
private final ConcurrentMap<String, AbstractAnnotationBeanPostProcessor.AnnotatedInjectionMetadata>
injectionMetadataCache = new ConcurrentHashMap<
String, AbstractAnnotationBeanPostProcessor.AnnotatedInjectionMetadata>(CACHE_SIZE);
injectionMetadataCache = new ConcurrentHashMap<>(CACHE_SIZE);
private ConfigurableListableBeanFactory beanFactory;
@ -98,7 +97,7 @@ public abstract class AbstractAnnotationBeanPostProcessor
}
private static <T> Collection<T> combine(Collection<? extends T>... elements) {
List<T> allElements = new ArrayList<T>();
List<T> allElements = new ArrayList<>();
for (Collection<? extends T> e : elements) {
allElements.addAll(e);
}

View File

@ -87,7 +87,7 @@ public abstract class AnnotationUtils {
Set<String> ignoreAttributeNamesSet = new HashSet<>(Arrays.asList(ignoreAttributeNames));
Map<String, Object> actualAttributes = new LinkedHashMap<String, Object>();
Map<String, Object> actualAttributes = new LinkedHashMap<>();
for (Map.Entry<String, Object> annotationAttribute : annotationAttributes.entrySet()) {
@ -143,7 +143,7 @@ public abstract class AnnotationUtils {
if (ignoreDefaultValue && !isEmpty(annotationAttributes)) {
List<String> attributeNamesToIgnore = new LinkedList<String>(asList(ignoreAttributeNames));
List<String> attributeNamesToIgnore = new LinkedList<>(asList(ignoreAttributeNames));
for (Map.Entry<String, Object> annotationAttribute : annotationAttributes.entrySet()) {
String attributeName = annotationAttribute.getKey();

View File

@ -103,7 +103,7 @@ public abstract class PropertySourcesUtils {
public static Map<String, Object> getSubProperties(
PropertySources propertySources, PropertyResolver propertyResolver, String prefix) {
Map<String, Object> subProperties = new LinkedHashMap<String, Object>();
Map<String, Object> subProperties = new LinkedHashMap<>();
String normalizedPrefix = normalizePrefix(prefix);

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You 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.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you 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.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you 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.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you 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.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you 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.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you 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.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@ -189,7 +189,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<version>3.13.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>

View File

@ -189,7 +189,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<version>3.13.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>

View File

@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you 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.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@ -32,7 +30,7 @@
<skip_maven_deploy>true</skip_maven_deploy>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
<maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version>
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
</properties>
<dependencies>

View File

@ -90,16 +90,16 @@
<properties>
<!-- Common libs -->
<!-- <spring_version>4.3.30.RELEASE</spring_version> -->
<spring_version>5.3.25</spring_version>
<spring_security_version>5.8.10</spring_security_version>
<spring_version>5.3.33</spring_version>
<spring_security_version>5.8.11</spring_security_version>
<javassist_version>3.30.2-GA</javassist_version>
<byte-buddy_version>1.14.12</byte-buddy_version>
<byte-buddy_version>1.14.13</byte-buddy_version>
<netty_version>3.2.10.Final</netty_version>
<netty4_version>4.1.107.Final</netty4_version>
<netty4_version>4.1.108.Final</netty4_version>
<httpclient_version>4.5.14</httpclient_version>
<httpcore_version>4.4.16</httpcore_version>
<fastjson_version>1.2.83</fastjson_version>
<fastjson2_version>2.0.47</fastjson2_version>
<fastjson2_version>2.0.48</fastjson2_version>
<zookeeper_version>3.7.2</zookeeper_version>
<curator_version>5.1.0</curator_version>
<curator_test_version>2.12.0</curator_test_version>
@ -133,22 +133,22 @@
<rs_api_version>2.1.1</rs_api_version>
<resteasy_version>3.15.6.Final</resteasy_version>
<codehaus-jackson_version>1.9.13</codehaus-jackson_version>
<tomcat_embed_version>8.5.99</tomcat_embed_version>
<nacos_version>2.3.1</nacos_version>
<tomcat_embed_version>8.5.100</tomcat_embed_version>
<nacos_version>2.3.2</nacos_version>
<sentinel.version>1.8.6</sentinel.version>
<seata.version>1.6.1</seata.version>
<grpc.version>1.62.2</grpc.version>
<grpc.version>1.63.0</grpc.version>
<grpc_contrib_verdion>0.8.1</grpc_contrib_verdion>
<jprotoc_version>1.2.2</jprotoc_version>
<mustache_version>0.9.10</mustache_version>
<!-- Log libs -->
<slf4j_version>1.7.36</slf4j_version>
<jcl_version>1.3.0</jcl_version>
<jcl_version>1.3.1</jcl_version>
<log4j_version>1.2.17</log4j_version>
<logback_version>1.2.13</logback_version>
<!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
<log4j2_version>2.23.1</log4j2_version>
<commons_io_version>2.15.1</commons_io_version>
<commons_io_version>2.16.0</commons_io_version>
<commons-codec_version>1.16.0</commons-codec_version>
<embedded_redis_version>0.13.0</embedded_redis_version>
@ -168,7 +168,7 @@
<activation_version>1.2.0</activation_version>
<test_container_version>1.19.7</test_container_version>
<hessian_lite_version>3.2.13</hessian_lite_version>
<swagger_version>1.6.13</swagger_version>
<swagger_version>1.6.14</swagger_version>
<snappy_java_version>1.1.10.5</snappy_java_version>
<bouncycastle-bcprov_version>1.70</bouncycastle-bcprov_version>

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You 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.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You 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.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@ -52,7 +52,7 @@
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.0</version>
<version>3.7.1</version>
<executions>
<execution>
<id>bin</id>

View File

@ -49,7 +49,7 @@
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.11.0</version>
<version>3.12.0</version>
<scope>provided</scope>
</dependency>
@ -68,7 +68,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.15.1</version>
<version>2.16.0</version>
</dependency>
<!-- Takes no effect for this dependency. To notify github dependencies bot to update ${protobuf-java.version} property. -->

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You 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.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You 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.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@ -258,7 +258,7 @@ public class NacosMetadataReport extends AbstractMetadataReport {
if (StringUtils.isEmpty(content)) {
return Collections.emptyList();
}
return new ArrayList<String>(Arrays.asList(URL.decode(content)));
return new ArrayList<>(Arrays.asList(URL.decode(content)));
}
@Override

View File

@ -42,7 +42,7 @@ public abstract class AbstractCacheFactory implements CacheFactory {
/**
* This is used to store factory level-1 cached data.
*/
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>();
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<>();
private final Object MONITOR = new Object();

View File

@ -158,7 +158,7 @@ public class ExpiringMap<K, V> implements Map<K, V> {
@Override
public Collection<V> values() {
List<V> list = new ArrayList<V>();
List<V> list = new ArrayList<>();
Set<Entry<K, ExpiryObject>> delegatedSet = delegateMap.entrySet();
for (Entry<K, ExpiryObject> entry : delegatedSet) {
ExpiryObject value = entry.getValue();

View File

@ -46,7 +46,7 @@ public class HttpCommandDecoder {
commandContext = CommandContextFactory.newInstance(name);
commandContext.setHttp(true);
} else {
List<String> valueList = new ArrayList<String>();
List<String> valueList = new ArrayList<>();
for (List<String> values :
queryStringDecoder.parameters().values()) {
valueList.addAll(values);
@ -56,7 +56,7 @@ public class HttpCommandDecoder {
}
} else if (request.method() == HttpMethod.POST) {
HttpPostRequestDecoder httpPostRequestDecoder = new HttpPostRequestDecoder(request);
List<String> valueList = new ArrayList<String>();
List<String> valueList = new ArrayList<>();
for (InterfaceHttpData interfaceHttpData : httpPostRequestDecoder.getBodyHttpDatas()) {
if (interfaceHttpData.getHttpDataType() == InterfaceHttpData.HttpDataType.Attribute) {
Attribute attribute = (Attribute) interfaceHttpData;

View File

@ -155,8 +155,8 @@ public class CountTelnet implements BaseCommand {
private String count(Invoker<?> invoker, String method) {
URL url = invoker.getUrl();
List<List<String>> table = new ArrayList<List<String>>();
List<String> header = new ArrayList<String>();
List<List<String>> table = new ArrayList<>();
List<String> header = new ArrayList<>();
header.add("method");
header.add("total");
header.add("failed");
@ -188,7 +188,7 @@ public class CountTelnet implements BaseCommand {
}
private List<String> createRow(String methodName, RpcStatus count) {
List<String> row = new ArrayList<String>();
List<String> row = new ArrayList<>();
row.add(methodName);
row.add(String.valueOf(count.getTotal()));
row.add(String.valueOf(count.getFailed()));

View File

@ -46,7 +46,7 @@ public class CommandHelper {
public List<Class<?>> getAllCommandClass() {
final Set<String> commandList =
frameworkModel.getExtensionLoader(BaseCommand.class).getSupportedExtensions();
final List<Class<?>> classes = new ArrayList<Class<?>>();
final List<Class<?>> classes = new ArrayList<>();
for (String commandName : commandList) {
BaseCommand command =

View File

@ -35,7 +35,7 @@ public class TLadder implements TComponent {
// indent length
private static final int INDENT_STEP = 2;
private final List<String> items = new LinkedList<String>();
private final List<String> items = new LinkedList<>();
@Override
public String rendering() {

View File

@ -299,7 +299,7 @@ public class TTable implements TComponent {
private final Align align;
// data rows
private final List<String> rows = new ArrayList<String>();
private final List<String> rows = new ArrayList<>();
public ColumnDefine(int width, boolean isAutoResize, Align align) {
this.width = width;

View File

@ -181,7 +181,7 @@ public class TTree implements TComponent {
/**
* child nodes
*/
final List<Node> children = new ArrayList<Node>();
final List<Node> children = new ArrayList<>();
/**
* begin timestamp

View File

@ -82,7 +82,7 @@ public final class ReactorServerCalls {
public static <T, R> StreamObserver<T> manyToOne(
StreamObserver<R> responseObserver, Function<Flux<T>, Mono<R>> func) {
ServerTripleReactorPublisher<T> serverPublisher =
new ServerTripleReactorPublisher<T>((CallStreamObserver<R>) responseObserver);
new ServerTripleReactorPublisher<>((CallStreamObserver<R>) responseObserver);
try {
Mono<R> responseMono = func.apply(Flux.from(serverPublisher));
responseMono.subscribe(
@ -117,7 +117,7 @@ public final class ReactorServerCalls {
StreamObserver<R> responseObserver, Function<Flux<T>, Flux<R>> func) {
// responseObserver is also a subscription of publisher, we can use it to request more data
ServerTripleReactorPublisher<T> serverPublisher =
new ServerTripleReactorPublisher<T>((CallStreamObserver<R>) responseObserver);
new ServerTripleReactorPublisher<>((CallStreamObserver<R>) responseObserver);
try {
Flux<R> responseFlux = func.apply(Flux.from(serverPublisher));
ServerTripleReactorSubscriber<R> serverSubscriber =

View File

@ -75,6 +75,6 @@ public class InterfaceCompatibleRegistryProtocol extends RegistryProtocol {
URL url,
URL consumerUrl) {
// ClusterInvoker<T> invoker = getInvoker(cluster, registry, type, url);
return new MigrationInvoker<T>(registryProtocol, cluster, registry, type, url, consumerUrl);
return new MigrationInvoker<>(registryProtocol, cluster, registry, type, url, consumerUrl);
}
}

View File

@ -82,7 +82,7 @@ public class MulticastRegistry extends FailbackRegistry {
private final int multicastPort;
private final ConcurrentMap<URL, Set<URL>> received = new ConcurrentHashMap<URL, Set<URL>>();
private final ConcurrentMap<URL, Set<URL>> received = new ConcurrentHashMap<>();
private final ScheduledExecutorService cleanExecutor =
Executors.newScheduledThreadPool(1, new NamedThreadFactory("DubboMulticastRegistryCleanTimer", true));
@ -361,7 +361,7 @@ public class MulticastRegistry extends FailbackRegistry {
}
if (urls == null || urls.isEmpty()) {
if (urls == null) {
urls = new ConcurrentHashSet<URL>();
urls = new ConcurrentHashSet<>();
}
URL empty = url.setProtocol(EMPTY_PROTOCOL);
urls.add(empty);
@ -380,7 +380,7 @@ public class MulticastRegistry extends FailbackRegistry {
}
private List<URL> toList(Set<URL> urls) {
List<URL> list = new ArrayList<URL>();
List<URL> list = new ArrayList<>();
if (CollectionUtils.isNotEmpty(urls)) {
list.addAll(urls);
}

View File

@ -268,7 +268,7 @@ public class MultipleRegistry extends AbstractRegistry {
protected static class MultipleNotifyListenerWrapper implements NotifyListener {
Map<URL, SingleNotifyListener> registryMap = new ConcurrentHashMap<URL, SingleNotifyListener>(4);
Map<URL, SingleNotifyListener> registryMap = new ConcurrentHashMap<>(4);
NotifyListener sourceNotifyListener;
public MultipleNotifyListenerWrapper(NotifyListener sourceNotifyListener) {

View File

@ -30,7 +30,7 @@ public class ReplierDispatcher implements Replier<Object> {
private final Replier<?> defaultReplier;
private final Map<Class<?>, Replier<?>> repliers = new ConcurrentHashMap<Class<?>, Replier<?>>();
private final Map<Class<?>, Replier<?>> repliers = new ConcurrentHashMap<>();
public ReplierDispatcher() {
this(null, null);

View File

@ -161,7 +161,7 @@ public class HeaderExchangeServer implements ExchangeServer {
@Override
public Collection<ExchangeChannel> getExchangeChannels() {
Collection<ExchangeChannel> exchangeChannels = new ArrayList<ExchangeChannel>();
Collection<ExchangeChannel> exchangeChannels = new ArrayList<>();
Collection<Channel> channels = server.getChannels();
if (CollectionUtils.isNotEmpty(channels)) {
for (Channel channel : channels) {

View File

@ -283,7 +283,7 @@ public class TelnetCodec extends TransportCodec {
String result = toString(message, getCharset(channel));
if (result.trim().length() > 0) {
if (history == null) {
history = new LinkedList<String>();
history = new LinkedList<>();
channel.setAttribute(HISTORY_LIST_KEY, history);
}
if (history.isEmpty()) {

View File

@ -73,12 +73,12 @@ public class HelpTelnetHandler implements TelnetHandler {
}
private String generateForAllCommand(Channel channel) {
List<List<String>> table = new ArrayList<List<String>>();
List<List<String>> table = new ArrayList<>();
List<TelnetHandler> handlers = extensionLoader.getActivateExtension(channel.getUrl(), "telnet");
if (CollectionUtils.isNotEmpty(handlers)) {
for (TelnetHandler handler : handlers) {
Help help = handler.getClass().getAnnotation(Help.class);
List<String> row = new ArrayList<String>();
List<String> row = new ArrayList<>();
String parameter = " " + extensionLoader.getExtensionName(handler) + " "
+ (help != null ? help.parameter().replace("\r\n", " ").replace("\n", " ") : "");
row.add(parameter.length() > 55 ? parameter.substring(0, 55) + "..." : parameter);

View File

@ -53,8 +53,8 @@ public class StatusTelnetHandler implements TelnetHandler {
if ("-l".equals(message)) {
List<StatusChecker> checkers = extensionLoader.getActivateExtension(channel.getUrl(), STATUS_KEY);
String[] header = new String[] {"resource", "status", "message"};
List<List<String>> table = new ArrayList<List<String>>();
Map<String, Status> statuses = new HashMap<String, Status>();
List<List<String>> table = new ArrayList<>();
Map<String, Status> statuses = new HashMap<>();
if (CollectionUtils.isNotEmpty(checkers)) {
for (StatusChecker checker : checkers) {
String name = extensionLoader.getExtensionName(checker);
@ -66,7 +66,7 @@ public class StatusTelnetHandler implements TelnetHandler {
}
statuses.put(name, stat);
if (stat.getLevel() != null && stat.getLevel() != Status.Level.UNKNOWN) {
List<String> row = new ArrayList<String>();
List<String> row = new ArrayList<>();
row.add(name);
row.add(String.valueOf(stat.getLevel()));
row.add(stat.getMessage() == null ? "" : stat.getMessage());
@ -75,7 +75,7 @@ public class StatusTelnetHandler implements TelnetHandler {
}
}
Status stat = StatusUtils.getSummaryStatus(statuses);
List<String> row = new ArrayList<String>();
List<String> row = new ArrayList<>();
row.add("summary");
row.add(String.valueOf(stat.getLevel()));
row.add(stat.getMessage());
@ -85,7 +85,7 @@ public class StatusTelnetHandler implements TelnetHandler {
return "Unsupported parameter " + message + " for status.";
}
String status = channel.getUrl().getParameter("status");
Map<String, Status> statuses = new HashMap<String, Status>();
Map<String, Status> statuses = new HashMap<>();
if (StringUtils.isNotEmpty(status)) {
String[] ss = COMMA_SPLIT_PATTERN.split(status);
for (String s : ss) {

View File

@ -21,6 +21,7 @@ import org.apache.dubbo.common.Version;
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.threadpool.manager.ExecutorRepository;
import org.apache.dubbo.common.threadpool.manager.FrameworkExecutorRepository;
import org.apache.dubbo.common.utils.NetUtils;
import org.apache.dubbo.remoting.Channel;
import org.apache.dubbo.remoting.ChannelHandler;
@ -28,9 +29,11 @@ import org.apache.dubbo.remoting.Client;
import org.apache.dubbo.remoting.Constants;
import org.apache.dubbo.remoting.RemotingException;
import org.apache.dubbo.remoting.transport.dispatcher.ChannelHandlers;
import org.apache.dubbo.rpc.model.FrameworkModel;
import java.net.InetSocketAddress;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@ -41,6 +44,11 @@ import static org.apache.dubbo.common.constants.CommonConstants.THREAD_NAME_KEY;
import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_CLOSE;
import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_CONNECT_PROVIDER;
import static org.apache.dubbo.config.Constants.CLIENT_THREAD_POOL_NAME;
import static org.apache.dubbo.remoting.Constants.HEARTBEAT_CHECK_TICK;
import static org.apache.dubbo.remoting.Constants.LEAST_HEARTBEAT_DURATION;
import static org.apache.dubbo.remoting.Constants.LEAST_RECONNECT_DURATION;
import static org.apache.dubbo.remoting.Constants.LEAST_RECONNECT_DURATION_KEY;
import static org.apache.dubbo.remoting.utils.UrlUtils.getIdleTimeout;
/**
* AbstractClient
@ -55,13 +63,23 @@ public abstract class AbstractClient extends AbstractEndpoint implements Client
protected volatile ExecutorService executor;
protected volatile ScheduledExecutorService connectivityExecutor;
private FrameworkModel frameworkModel;
protected long reconnectDuaration;
public AbstractClient(URL url, ChannelHandler handler) throws RemotingException {
super(url, handler);
// set default needReconnect true when channel is not connected
needReconnect = url.getParameter(Constants.SEND_RECONNECT_KEY, true);
frameworkModel = url.getOrDefaultFrameworkModel();
initExecutor(url);
reconnectDuaration = getReconnectDuration(url);
try {
doOpen();
} catch (Throwable t) {
@ -134,6 +152,11 @@ public abstract class AbstractClient extends AbstractEndpoint implements Client
url = url.addParameter(THREAD_NAME_KEY, CLIENT_THREAD_POOL_NAME)
.addParameterIfAbsent(THREADPOOL_KEY, DEFAULT_CLIENT_THREADPOOL);
executor = executorRepository.createExecutorIfAbsent(url);
connectivityExecutor = frameworkModel
.getBeanFactory()
.getBean(FrameworkExecutorRepository.class)
.getConnectivityScheduledExecutor();
}
protected static ChannelHandler wrapChannelHandler(URL url, ChannelHandler handler) {
@ -296,6 +319,25 @@ public abstract class AbstractClient extends AbstractEndpoint implements Client
}
}
private long getReconnectDuration(URL url) {
int idleTimeout = getIdleTimeout(url);
long heartbeatTimeoutTick = calculateLeastDuration(idleTimeout);
return calculateReconnectDuration(url, heartbeatTimeoutTick);
}
private long calculateLeastDuration(int time) {
if (time / HEARTBEAT_CHECK_TICK <= 0) {
return LEAST_HEARTBEAT_DURATION;
} else {
return time / HEARTBEAT_CHECK_TICK;
}
}
private long calculateReconnectDuration(URL url, long tick) {
long leastReconnectDuration = url.getParameter(LEAST_RECONNECT_DURATION_KEY, LEAST_RECONNECT_DURATION);
return Math.max(leastReconnectDuration, tick);
}
@Override
public void reconnect() throws RemotingException {
connectLock.lock();

View File

@ -42,9 +42,9 @@ import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FA
public class CodecSupport {
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(CodecSupport.class);
private static Map<Byte, Serialization> ID_SERIALIZATION_MAP = new HashMap<Byte, Serialization>();
private static Map<Byte, String> ID_SERIALIZATIONNAME_MAP = new HashMap<Byte, String>();
private static Map<String, Byte> SERIALIZATIONNAME_ID_MAP = new HashMap<String, Byte>();
private static Map<Byte, Serialization> ID_SERIALIZATION_MAP = new HashMap<>();
private static Map<Byte, String> ID_SERIALIZATIONNAME_MAP = new HashMap<>();
private static Map<String, Byte> SERIALIZATIONNAME_ID_MAP = new HashMap<>();
// Cache null object serialize results, for heartbeat request/response serialize use.
private static ConcurrentMap<Byte, byte[]> ID_NULLBYTES_MAP = new ConcurrentHashMap<>();

View File

@ -35,8 +35,8 @@ public class RequestTemplate implements Serializable {
public static final String ENCODING_DEFLATE = "deflate";
private static final List<String> EMPTY_ARRAYLIST = new ArrayList<>();
private final Map<String, Collection<String>> queries = new LinkedHashMap<String, Collection<String>>();
private final Map<String, Collection<String>> headers = new LinkedHashMap<String, Collection<String>>();
private final Map<String, Collection<String>> queries = new LinkedHashMap<>();
private final Map<String, Collection<String>> headers = new LinkedHashMap<>();
private String httpMethod;
private String path;
private String address;

View File

@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class DispatcherServlet extends HttpServlet {
private static final long serialVersionUID = 5766349180380479888L;
private static final Map<Integer, HttpHandler> HANDLERS = new ConcurrentHashMap<Integer, HttpHandler>();
private static final Map<Integer, HttpHandler> HANDLERS = new ConcurrentHashMap<>();
private static DispatcherServlet INSTANCE;
public DispatcherServlet() {

View File

@ -30,7 +30,7 @@ public class ServletManager {
private static final ServletManager INSTANCE = new ServletManager();
private final Map<Integer, ServletContext> contextMap = new ConcurrentHashMap<Integer, ServletContext>();
private final Map<Integer, ServletContext> contextMap = new ConcurrentHashMap<>();
public static ServletManager getInstance() {
return INSTANCE;

View File

@ -43,11 +43,11 @@ final class NettyChannel extends AbstractChannel {
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(NettyChannel.class);
private static final ConcurrentMap<org.jboss.netty.channel.Channel, NettyChannel> CHANNEL_MAP =
new ConcurrentHashMap<org.jboss.netty.channel.Channel, NettyChannel>();
new ConcurrentHashMap<>();
private final org.jboss.netty.channel.Channel channel;
private final Map<String, Object> attributes = new ConcurrentHashMap<String, Object>();
private final Map<String, Object> attributes = new ConcurrentHashMap<>();
private NettyChannel(org.jboss.netty.channel.Channel channel, URL url, ChannelHandler handler) {
super(url, handler);

View File

@ -42,7 +42,7 @@ public class NettyHandler extends SimpleChannelHandler {
private static final Logger logger = LoggerFactory.getLogger(NettyHandler.class);
private final Map<String, Channel> channels = new ConcurrentHashMap<String, Channel>(); // <ip:port, channel>
private final Map<String, Channel> channels = new ConcurrentHashMap<>(); // <ip:port, channel>
private final URL url;

View File

@ -61,14 +61,13 @@ final class NettyChannel extends AbstractChannel {
/**
* the cache for netty channel and dubbo channel
*/
private static final ConcurrentMap<Channel, NettyChannel> CHANNEL_MAP =
new ConcurrentHashMap<Channel, NettyChannel>();
private static final ConcurrentMap<Channel, NettyChannel> CHANNEL_MAP = new ConcurrentHashMap<>();
/**
* netty channel
*/
private final Channel channel;
private final Map<String, Object> attributes = new ConcurrentHashMap<String, Object>();
private final Map<String, Object> attributes = new ConcurrentHashMap<>();
private final AtomicBoolean active = new AtomicBoolean(false);

View File

@ -43,7 +43,6 @@ import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoop;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.ssl.SslContext;
import io.netty.handler.timeout.IdleStateHandler;
@ -75,6 +74,8 @@ public class NettyConnectionClient extends AbstractConnectionClient {
public static final AttributeKey<AbstractConnectionClient> CONNECTION = AttributeKey.valueOf("connection");
private AtomicBoolean isReconnecting;
public NettyConnectionClient(URL url, ChannelHandler handler) throws RemotingException {
super(url, handler);
}
@ -91,6 +92,7 @@ public class NettyConnectionClient extends AbstractConnectionClient {
this.closePromise = new DefaultPromise<>(GlobalEventExecutor.INSTANCE);
this.init = new AtomicBoolean(false);
this.increase();
this.isReconnecting = new AtomicBoolean(false);
}
@Override
@ -158,6 +160,10 @@ public class NettyConnectionClient extends AbstractConnectionClient {
@Override
protected void doConnect() throws RemotingException {
if (!isReconnecting.compareAndSet(false, true)) {
return;
}
if (isClosed()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
@ -347,6 +353,11 @@ public class NettyConnectionClient extends AbstractConnectionClient {
@Override
public void operationComplete(ChannelFuture future) {
if (!isReconnecting.compareAndSet(true, false)) {
return;
}
if (future.isSuccess()) {
return;
}
@ -364,8 +375,8 @@ public class NettyConnectionClient extends AbstractConnectionClient {
"%s is reconnecting, attempt=%d cause=%s",
connectionClient, 0, future.cause().getMessage()));
}
final EventLoop loop = future.channel().eventLoop();
loop.schedule(
connectivityExecutor.schedule(
() -> {
try {
connectionClient.doConnect();
@ -377,8 +388,8 @@ public class NettyConnectionClient extends AbstractConnectionClient {
"Failed to connect to server: " + getConnectAddress());
}
},
1L,
TimeUnit.SECONDS);
reconnectDuaration,
TimeUnit.MILLISECONDS);
}
}
}

View File

@ -28,6 +28,7 @@ import org.apache.dubbo.remoting.api.pu.DefaultPuHandler;
import org.apache.dubbo.rpc.model.ApplicationModel;
import org.apache.dubbo.rpc.model.ModuleModel;
import java.time.Duration;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -39,6 +40,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.apache.dubbo.common.constants.CommonConstants.EXECUTOR_MANAGEMENT_MODE_DEFAULT;
import static org.awaitility.Awaitility.await;
public class ConnectionTest {
@ -138,6 +140,7 @@ public class ConnectionTest {
nettyPortUnificationServer.bind();
// auto reconnect
await().atMost(Duration.ofSeconds(100)).until(() -> connectionClient.isAvailable());
Assertions.assertTrue(connectionClient.isAvailable());
connectionClient.close();

View File

@ -459,7 +459,7 @@ public class RpcServiceContext extends RpcContext {
public RpcServiceContext setInvokers(List<Invoker<?>> invokers) {
this.invokers = invokers;
if (CollectionUtils.isNotEmpty(invokers)) {
List<URL> urls = new ArrayList<URL>(invokers.size());
List<URL> urls = new ArrayList<>(invokers.size());
for (Invoker<?> invoker : invokers) {
urls.add(invoker.getUrl());
}

View File

@ -33,13 +33,12 @@ import java.util.concurrent.atomic.AtomicLong;
*/
public class RpcStatus {
private static final ConcurrentMap<String, RpcStatus> SERVICE_STATISTICS =
new ConcurrentHashMap<String, RpcStatus>();
private static final ConcurrentMap<String, RpcStatus> SERVICE_STATISTICS = new ConcurrentHashMap<>();
private static final ConcurrentMap<String, ConcurrentMap<String, RpcStatus>> METHOD_STATISTICS =
new ConcurrentHashMap<String, ConcurrentMap<String, RpcStatus>>();
new ConcurrentHashMap<>();
private final ConcurrentMap<String, Object> values = new ConcurrentHashMap<String, Object>();
private final ConcurrentMap<String, Object> values = new ConcurrentHashMap<>();
private final AtomicInteger active = new AtomicInteger();
private final AtomicLong total = new AtomicLong();

View File

@ -44,7 +44,7 @@ public class DeprecatedFilter implements Filter {
private static final ErrorTypeAwareLogger LOGGER = LoggerFactory.getErrorTypeAwareLogger(DeprecatedFilter.class);
private static final Set<String> LOGGED = new ConcurrentHashSet<String>();
private static final Set<String> LOGGED = new ConcurrentHashSet<>();
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {

View File

@ -35,7 +35,7 @@ import static org.apache.dubbo.rpc.Constants.TPS_LIMIT_RATE_KEY;
*/
public class DefaultTPSLimiter implements TPSLimiter {
private final ConcurrentMap<String, StatItem> stats = new ConcurrentHashMap<String, StatItem>();
private final ConcurrentMap<String, StatItem> stats = new ConcurrentHashMap<>();
@Override
public boolean isAllowable(URL url, Invocation invocation) {

View File

@ -50,7 +50,7 @@ import static org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_UNS
*/
public abstract class AbstractProxyProtocol extends AbstractProtocol {
private final List<Class<?>> rpcExceptions = new CopyOnWriteArrayList<Class<?>>();
private final List<Class<?>> rpcExceptions = new CopyOnWriteArrayList<>();
protected ProxyFactory proxyFactory;

View File

@ -74,8 +74,7 @@ public class ProtocolListenerWrapper implements Protocol {
.getBeanFactory()
.getBean(InjvmExporterListener.class));
}
return new ListenerExporterWrapper<T>(
protocol.export(invoker), Collections.unmodifiableList(exporterListeners));
return new ListenerExporterWrapper<>(protocol.export(invoker), Collections.unmodifiableList(exporterListeners));
}
@Override

Some files were not shown because too many files have changed in this diff Show More