Skip to content

Commit

Permalink
Merge branch '3.3' into feat/remove_old_zookeeper
Browse files Browse the repository at this point in the history
# Conflicts:
#	dubbo-dependencies/dubbo-dependencies-zookeeper/pom.xml
  • Loading branch information
Stellar1999 committed Apr 11, 2024
2 parents 7fa4b7f + 314547e commit 4375e66
Show file tree
Hide file tree
Showing 120 changed files with 434 additions and 384 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private void printRouterSnapshot(URL url, BitList<Invoker<T>> availableInvokers,
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
Expand All @@ -227,7 +227,7 @@ public RouterSnapshotNode<T> buildRouterSnapshot(
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;

Expand All @@ -237,7 +237,7 @@ public RouterSnapshotNode<T> buildRouterSnapshot(
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private boolean isDeprecatedConditionMatch(Set<String> conditionKeys, URL url) {
}

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -75,7 +74,7 @@ private static final class ConsistentHashSelector<T> {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Set<Object> merge(Set<?>... items) {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static <T> MeshRuleCache<T> build(
Collections.unmodifiableMap(totalSubsetMap),
unmatchedInvokers);
} else {
return new MeshRuleCache<T>(
return new MeshRuleCache<>(
Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap(), invokers);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public Result doInvoke(Invocation invocation, final List<Invoker<T>> invokers, L
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public MockClusterWrapper(Cluster 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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
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 = ";";
Expand Down Expand Up @@ -72,7 +72,7 @@ public static JavaBeanDescriptor serialize(Object obj, JavaBeanAccessor accessor
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);
}

Expand Down Expand Up @@ -209,7 +209,7 @@ public static Object deserialize(JavaBeanDescriptor beanDescriptor, ClassLoader
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static Mixin mixin(Class<?>[] ics, Class<?>[] dcs, ClassLoader cl) {

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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
* 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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public static String getInitCode(Class<?> type) {
}

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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private static void reportTooManyInstances() {
}

private final class Worker implements Runnable {
private final Set<Timeout> unprocessedTimeouts = new HashSet<Timeout>();
private final Set<Timeout> unprocessedTimeouts = new HashSet<>();

private long tick;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void calculate() throws UnknownHostException {

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++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static boolean isDefault(String value) {
*/
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)) {
Expand All @@ -96,7 +96,7 @@ public static List<String> mergeValues(
}
}

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static String[] readLines(File file) throws IOException {
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
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() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ public static String join(final Object[] array, final char delimiter, final int
*/
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()) {
Expand All @@ -902,7 +902,7 @@ public static String getQueryStringValue(String qs, String key) {
*/
public static Map<String, String> parseQueryString(String qs) {
if (isEmpty(qs)) {
return new HashMap<String, String>();
return new HashMap<>();
}
return parseKeyValuePair(qs, "\\&");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public static List<URL> parseURLs(String address, Map<String, String> defaults)
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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public AbstractInterfaceConfig(ModuleModel moduleModel) {
/**
* 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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public RegistryConfig getRegistry() {
}

public void setRegistry(RegistryConfig registry) {
List<RegistryConfig> registries = new ArrayList<RegistryConfig>(1);
List<RegistryConfig> registries = new ArrayList<>(1);
registries.add(registry);
this.registries = registries;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static List<Field> getNonStaticFields(final Class<?> clazz) {
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void setRegistryUrl(URL registryUrl) {
}

public List<ProviderMethodModel> getAllMethodModels() {
List<ProviderMethodModel> result = new ArrayList<ProviderMethodModel>();
List<ProviderMethodModel> result = new ArrayList<>();
for (List<ProviderMethodModel> models : methods.values()) {
result.addAll(models);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private static List<ProtocolConfig> convertProviderToProtocol(List<ProviderConfi
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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public Page(String navigation, String title, List<String> columns, List<List<Str
}

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Loading

0 comments on commit 4375e66

Please sign in to comment.