This is an automated email from the ASF dual-hosted git repository. jerrick pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push: new 18dee4e code format (#2528) 18dee4e is described below commit 18dee4e44df7a02cacb3070fda72e22d7078f910 Author: Lei Jiang <ladd...@gmail.com> AuthorDate: Fri Sep 21 08:57:27 2018 +0800 code format (#2528) --- .../rpc/cluster/directory/AbstractDirectory.java | 3 +- .../rpc/cluster/directory/StaticDirectory.java | 3 +- .../cluster/loadbalance/AbstractLoadBalance.java | 6 +- .../loadbalance/LeastActiveLoadBalance.java | 3 +- .../rpc/cluster/router/MockInvokersSelector.java | 4 +- .../cluster/router/condition/ConditionRouter.java | 9 ++- .../cluster/support/AbstractClusterInvoker.java | 6 +- .../validation/support/jvalidation/JValidator.java | 23 ++++---- .../java/org/apache/dubbo/metrics/MetricName.java | 66 ++++++++++++++-------- .../org/apache/dubbo/monitor/dubbo/Statistics.java | 51 +++++++++++------ .../registry/integration/RegistryDirectory.java | 9 ++- .../dubbo/registry/support/AbstractRegistry.java | 4 +- .../apache/dubbo/registry/dubbo/DubboRegistry.java | 3 +- .../apache/dubbo/registry/redis/RedisRegistry.java | 24 +++++--- .../apache/dubbo/remoting/exchange/Request.java | 4 +- .../support/header/HeaderExchangeChannel.java | 20 +++++-- .../support/header/HeaderExchangeServer.java | 3 +- .../remoting/transport/grizzly/GrizzlyClient.java | 3 +- .../dubbo/remoting/transport/mina/MinaClient.java | 3 +- .../remoting/transport/netty4/NettyChannel.java | 20 +++++-- .../serialize/java/CompactedObjectInputStream.java | 3 +- 21 files changed, 180 insertions(+), 90 deletions(-) diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java index 52f5811..0cea0b8 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java @@ -59,8 +59,9 @@ public abstract class AbstractDirectory<T> implements Directory<T> { } public AbstractDirectory(URL url, URL consumerUrl, List<Router> routers) { - if (url == null) + if (url == null) { throw new IllegalArgumentException("url == null"); + } this.url = url; this.consumerUrl = consumerUrl; setRouters(routers); diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectory.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectory.java index 47a0d12..cc6bab3 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectory.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectory.java @@ -46,8 +46,9 @@ public class StaticDirectory<T> extends AbstractDirectory<T> { public StaticDirectory(URL url, List<Invoker<T>> invokers, List<Router> routers) { super(url == null && invokers != null && !invokers.isEmpty() ? invokers.get(0).getUrl() : url, routers); - if (invokers == null || invokers.isEmpty()) + if (invokers == null || invokers.isEmpty()) { throw new IllegalArgumentException("invokers == null"); + } this.invokers = invokers; } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalance.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalance.java index ff94b3c..7a8d0aa 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalance.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalance.java @@ -37,10 +37,12 @@ public abstract class AbstractLoadBalance implements LoadBalance { @Override public <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) { - if (invokers == null || invokers.isEmpty()) + if (invokers == null || invokers.isEmpty()) { return null; - if (invokers.size() == 1) + } + if (invokers.size() == 1) { return invokers.get(0); + } return doSelect(invokers, url, invocation); } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java index 956ff77..d0ea49c 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java @@ -75,8 +75,9 @@ public class LeastActiveLoadBalance extends AbstractLoadBalance { for (int i = 0; i < leastCount; i++) { int leastIndex = leastIndexes[i]; offsetWeight -= getWeight(invokers.get(leastIndex), invocation); - if (offsetWeight <= 0) + if (offsetWeight <= 0) { return invokers.get(leastIndex); + } } } // If all invokers have the same weight value or totalWeight=0, return evenly. diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/MockInvokersSelector.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/MockInvokersSelector.java index 0ca2a49..35ce7e5 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/MockInvokersSelector.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/MockInvokersSelector.java @@ -40,9 +40,9 @@ public class MockInvokersSelector implements Router { return getNormalInvokers(invokers); } else { String value = invocation.getAttachments().get(Constants.INVOCATION_NEED_MOCK); - if (value == null) + if (value == null) { return getNormalInvokers(invokers); - else if (Boolean.TRUE.toString().equalsIgnoreCase(value)) { + } else if (Boolean.TRUE.toString().equalsIgnoreCase(value)) { return getMockedInvokers(invokers); } } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionRouter.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionRouter.java index af36757..503ede9 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionRouter.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionRouter.java @@ -105,33 +105,36 @@ public class ConditionRouter implements Router, Comparable<Router> { } // The Value in the KV part. else if ("=".equals(separator)) { - if (pair == null) + if (pair == null) { throw new ParseException("Illegal route rule \"" + rule + "\", The error char '" + separator + "' at index " + matcher.start() + " before \"" + content + "\".", matcher.start()); + } values = pair.matches; values.add(content); } // The Value in the KV part. else if ("!=".equals(separator)) { - if (pair == null) + if (pair == null) { throw new ParseException("Illegal route rule \"" + rule + "\", The error char '" + separator + "' at index " + matcher.start() + " before \"" + content + "\".", matcher.start()); + } values = pair.mismatches; values.add(content); } // The Value in the KV part, if Value have more than one items. else if (",".equals(separator)) { // Should be seperateed by ',' - if (values == null || values.isEmpty()) + if (values == null || values.isEmpty()) { throw new ParseException("Illegal route rule \"" + rule + "\", The error char '" + separator + "' at index " + matcher.start() + " before \"" + content + "\".", matcher.start()); + } values.add(content); } else { throw new ParseException("Illegal route rule \"" + rule diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java index 51fe092..59b16ed 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java @@ -59,8 +59,9 @@ public abstract class AbstractClusterInvoker<T> implements Invoker<T> { } public AbstractClusterInvoker(Directory<T> directory, URL url) { - if (directory == null) + if (directory == null) { throw new IllegalArgumentException("service directory == null"); + } this.directory = directory; //sticky: invoker.isAvailable() should always be checked before using when availablecheck is true. @@ -110,8 +111,9 @@ public abstract class AbstractClusterInvoker<T> implements Invoker<T> { * @throws RpcException */ protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { - if (invokers == null || invokers.isEmpty()) + if (invokers == null || invokers.isEmpty()) { return null; + } String methodName = invocation == null ? "" : invocation.getMethodName(); boolean sticky = invokers.get(0).getUrl().getMethodParameter(methodName, Constants.CLUSTER_STICKY_KEY, Constants.DEFAULT_CLUSTER_STICKY); diff --git a/dubbo-filter/dubbo-filter-validation/src/main/java/org/apache/dubbo/validation/support/jvalidation/JValidator.java b/dubbo-filter/dubbo-filter-validation/src/main/java/org/apache/dubbo/validation/support/jvalidation/JValidator.java index 328c54c..a7c8afe 100644 --- a/dubbo-filter/dubbo-filter-validation/src/main/java/org/apache/dubbo/validation/support/jvalidation/JValidator.java +++ b/dubbo-filter/dubbo-filter-validation/src/main/java/org/apache/dubbo/validation/support/jvalidation/JValidator.java @@ -202,28 +202,29 @@ public class JValidator implements Validator { // Copy from javassist.bytecode.annotation.Annotation.createMemberValue(ConstPool, CtClass); private static MemberValue createMemberValue(ConstPool cp, CtClass type, Object value) throws NotFoundException { MemberValue memberValue = javassist.bytecode.annotation.Annotation.createMemberValue(cp, type); - if (memberValue instanceof BooleanMemberValue) + if (memberValue instanceof BooleanMemberValue) { ((BooleanMemberValue) memberValue).setValue((Boolean) value); - else if (memberValue instanceof ByteMemberValue) + } else if (memberValue instanceof ByteMemberValue) { ((ByteMemberValue) memberValue).setValue((Byte) value); - else if (memberValue instanceof CharMemberValue) + } else if (memberValue instanceof CharMemberValue) { ((CharMemberValue) memberValue).setValue((Character) value); - else if (memberValue instanceof ShortMemberValue) + } else if (memberValue instanceof ShortMemberValue) { ((ShortMemberValue) memberValue).setValue((Short) value); - else if (memberValue instanceof IntegerMemberValue) + } else if (memberValue instanceof IntegerMemberValue) { ((IntegerMemberValue) memberValue).setValue((Integer) value); - else if (memberValue instanceof LongMemberValue) + } else if (memberValue instanceof LongMemberValue) { ((LongMemberValue) memberValue).setValue((Long) value); - else if (memberValue instanceof FloatMemberValue) + } else if (memberValue instanceof FloatMemberValue) { ((FloatMemberValue) memberValue).setValue((Float) value); - else if (memberValue instanceof DoubleMemberValue) + } else if (memberValue instanceof DoubleMemberValue) { ((DoubleMemberValue) memberValue).setValue((Double) value); - else if (memberValue instanceof ClassMemberValue) + } else if (memberValue instanceof ClassMemberValue) { ((ClassMemberValue) memberValue).setValue(((Class<?>) value).getName()); - else if (memberValue instanceof StringMemberValue) + } else if (memberValue instanceof StringMemberValue) { ((StringMemberValue) memberValue).setValue((String) value); - else if (memberValue instanceof EnumMemberValue) + } else if (memberValue instanceof EnumMemberValue) { ((EnumMemberValue) memberValue).setValue(((Enum<?>) value).name()); + } /* else if (memberValue instanceof AnnotationMemberValue) */ else if (memberValue instanceof ArrayMemberValue) { CtClass arrayType = type.getComponentType(); diff --git a/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/MetricName.java b/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/MetricName.java index 93ae922..ca7edb9 100644 --- a/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/MetricName.java +++ b/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/MetricName.java @@ -204,8 +204,9 @@ public class MetricName implements Comparable<MetricName> { nameBuilder.append(name); } - if (!part.getTags().isEmpty()) + if (!part.getTags().isEmpty()) { tags.putAll(part.getTags()); + } } MetricLevel level = firstName == null ? null : firstName.getMetricLevel(); @@ -219,11 +220,13 @@ public class MetricName implements Comparable<MetricName> { * @return A newly created metric name with the specified path. **/ public static MetricName build(String... parts) { - if (parts == null || parts.length == 0) + if (parts == null || parts.length == 0) { return MetricName.EMPTY; + } - if (parts.length == 1) + if (parts.length == 1) { return new MetricName(parts[0], EMPTY_TAGS); + } return new MetricName(buildName(parts), EMPTY_TAGS); } @@ -233,8 +236,9 @@ public class MetricName implements Comparable<MetricName> { boolean first = true; for (String name : names) { - if (name == null || name.isEmpty()) + if (name == null || name.isEmpty()) { continue; + } if (first) { first = false; @@ -276,64 +280,78 @@ public class MetricName implements Comparable<MetricName> { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; + } - if (obj == null) + if (obj == null) { return false; + } - if (getClass() != obj.getClass()) + if (getClass() != obj.getClass()) { return false; + } MetricName other = (MetricName) obj; if (key == null) { - if (other.key != null) + if (other.key != null) { return false; - } else if (!key.equals(other.key)) + } + } else if (!key.equals(other.key)) { return false; + } - if (!tags.equals(other.tags)) + if (!tags.equals(other.tags)) { return false; + } return true; } @Override public int compareTo(MetricName o) { - if (o == null) + if (o == null) { return -1; + } int c = compareName(key, o.getKey()); - if (c != 0) + if (c != 0) { return c; + } return compareTags(tags, o.getTags()); } private int compareName(String left, String right) { - if (left == null && right == null) + if (left == null && right == null) { return 0; + } - if (left == null) + if (left == null) { return 1; + } - if (right == null) + if (right == null) { return -1; + } return left.compareTo(right); } private int compareTags(Map<String, String> left, Map<String, String> right) { - if (left == null && right == null) + if (left == null && right == null) { return 0; + } - if (left == null) + if (left == null) { return 1; + } - if (right == null) + if (right == null) { return -1; + } final Iterable<String> keys = uniqueSortedKeys(left, right); @@ -341,19 +359,23 @@ public class MetricName implements Comparable<MetricName> { final String a = left.get(key); final String b = right.get(key); - if (a == null && b == null) + if (a == null && b == null) { continue; + } - if (a == null) + if (a == null) { return -1; + } - if (b == null) + if (b == null) { return 1; + } int c = a.compareTo(b); - if (c != 0) + if (c != 0) { return c; + } } return 0; diff --git a/dubbo-monitor/dubbo-monitor-default/src/main/java/org/apache/dubbo/monitor/dubbo/Statistics.java b/dubbo-monitor/dubbo-monitor-default/src/main/java/org/apache/dubbo/monitor/dubbo/Statistics.java index cf9138e..bba7ac2 100644 --- a/dubbo-monitor/dubbo-monitor-default/src/main/java/org/apache/dubbo/monitor/dubbo/Statistics.java +++ b/dubbo-monitor/dubbo-monitor-default/src/main/java/org/apache/dubbo/monitor/dubbo/Statistics.java @@ -140,48 +140,65 @@ public class Statistics implements Serializable { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } Statistics other = (Statistics) obj; if (application == null) { - if (other.application != null) + if (other.application != null) { return false; - } else if (!application.equals(other.application)) + } + } else if (!application.equals(other.application)) { return false; + } if (client == null) { - if (other.client != null) + if (other.client != null) { return false; - } else if (!client.equals(other.client)) + } + } else if (!client.equals(other.client)) { return false; + } if (group == null) { - if (other.group != null) + if (other.group != null) { return false; - } else if (!group.equals(other.group)) + } + } else if (!group.equals(other.group)) { return false; + } if (method == null) { - if (other.method != null) + if (other.method != null) { return false; - } else if (!method.equals(other.method)) + } + } else if (!method.equals(other.method)) { return false; + } if (server == null) { - if (other.server != null) + if (other.server != null) { return false; - } else if (!server.equals(other.server)) + } + } else if (!server.equals(other.server)) { return false; + } if (service == null) { - if (other.service != null) + if (other.service != null) { return false; - } else if (!service.equals(other.service)) + } + } else if (!service.equals(other.service)) { return false; + } if (version == null) { - if (other.version != null) + if (other.version != null) { return false; - } else if (!version.equals(other.version)) + } + } else if (!version.equals(other.version)) { return false; + } return true; } diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java index 6b366b2..3a79cac 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java @@ -96,10 +96,12 @@ public class RegistryDirectory<T> extends AbstractDirectory<T> implements Notify public RegistryDirectory(Class<T> serviceType, URL url) { super(url); - if (serviceType == null) + if (serviceType == null) { throw new IllegalArgumentException("service type is null."); - if (url.getServiceKey() == null || url.getServiceKey().length() == 0) + } + if (url.getServiceKey() == null || url.getServiceKey().length() == 0) { throw new IllegalArgumentException("registry serviceKey is null."); + } this.serviceType = serviceType; this.serviceKey = url.getServiceKey(); this.queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY)); @@ -318,8 +320,9 @@ public class RegistryDirectory<T> extends AbstractDirectory<T> implements Notify } try { Router router = routerFactory.getRouter(url); - if (!routers.contains(router)) + if (!routers.contains(router)) { routers.add(router); + } } catch (Throwable t) { logger.error("convert router url to router error, url: " + url, t); } diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java index 406b8a8..61360f0 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java @@ -349,7 +349,9 @@ public abstract class AbstractRegistry implements Registry { } protected void notify(List<URL> urls) { - if (urls == null || urls.isEmpty()) return; + if (urls == null || urls.isEmpty()) { + return; + } for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) { URL url = entry.getKey(); diff --git a/dubbo-registry/dubbo-registry-default/src/main/java/org/apache/dubbo/registry/dubbo/DubboRegistry.java b/dubbo-registry/dubbo-registry-default/src/main/java/org/apache/dubbo/registry/dubbo/DubboRegistry.java index 60b4636..45c94a7 100644 --- a/dubbo-registry/dubbo-registry-default/src/main/java/org/apache/dubbo/registry/dubbo/DubboRegistry.java +++ b/dubbo-registry/dubbo-registry-default/src/main/java/org/apache/dubbo/registry/dubbo/DubboRegistry.java @@ -116,8 +116,9 @@ public class DubboRegistry extends FailbackRegistry { @Override public boolean isAvailable() { - if (registryInvoker == null) + if (registryInvoker == null) { return false; + } return registryInvoker.isAvailable(); } diff --git a/dubbo-registry/dubbo-registry-redis/src/main/java/org/apache/dubbo/registry/redis/RedisRegistry.java b/dubbo-registry/dubbo-registry-redis/src/main/java/org/apache/dubbo/registry/redis/RedisRegistry.java index b2be164..d372763 100644 --- a/dubbo-registry/dubbo-registry-redis/src/main/java/org/apache/dubbo/registry/redis/RedisRegistry.java +++ b/dubbo-registry/dubbo-registry-redis/src/main/java/org/apache/dubbo/registry/redis/RedisRegistry.java @@ -90,22 +90,30 @@ public class RedisRegistry extends FailbackRegistry { config.setTestOnBorrow(url.getParameter("test.on.borrow", true)); config.setTestOnReturn(url.getParameter("test.on.return", false)); config.setTestWhileIdle(url.getParameter("test.while.idle", false)); - if (url.getParameter("max.idle", 0) > 0) + if (url.getParameter("max.idle", 0) > 0) { config.setMaxIdle(url.getParameter("max.idle", 0)); - if (url.getParameter("min.idle", 0) > 0) + } + if (url.getParameter("min.idle", 0) > 0) { config.setMinIdle(url.getParameter("min.idle", 0)); - if (url.getParameter("max.active", 0) > 0) + } + if (url.getParameter("max.active", 0) > 0) { config.setMaxTotal(url.getParameter("max.active", 0)); - if (url.getParameter("max.total", 0) > 0) + } + if (url.getParameter("max.total", 0) > 0) { config.setMaxTotal(url.getParameter("max.total", 0)); - if (url.getParameter("max.wait", url.getParameter("timeout", 0)) > 0) + } + if (url.getParameter("max.wait", url.getParameter("timeout", 0)) > 0) { config.setMaxWaitMillis(url.getParameter("max.wait", url.getParameter("timeout", 0))); - if (url.getParameter("num.tests.per.eviction.run", 0) > 0) + } + if (url.getParameter("num.tests.per.eviction.run", 0) > 0) { config.setNumTestsPerEvictionRun(url.getParameter("num.tests.per.eviction.run", 0)); - if (url.getParameter("time.between.eviction.runs.millis", 0) > 0) + } + if (url.getParameter("time.between.eviction.runs.millis", 0) > 0) { config.setTimeBetweenEvictionRunsMillis(url.getParameter("time.between.eviction.runs.millis", 0)); - if (url.getParameter("min.evictable.idle.time.millis", 0) > 0) + } + if (url.getParameter("min.evictable.idle.time.millis", 0) > 0) { config.setMinEvictableIdleTimeMillis(url.getParameter("min.evictable.idle.time.millis", 0)); + } String cluster = url.getParameter("cluster", "failover"); if (!"failover".equals(cluster) && !"replicate".equals(cluster)) { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Request.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Request.java index e1f45fd..abd0582 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Request.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Request.java @@ -57,7 +57,9 @@ public class Request { } private static String safeToString(Object data) { - if (data == null) return null; + if (data == null) { + return null; + } String dataStr; try { dataStr = data.toString(); diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannel.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannel.java index 73503cd..4aef993 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannel.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannel.java @@ -221,13 +221,23 @@ final class HeaderExchangeChannel implements ExchangeChannel { @Override public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } HeaderExchangeChannel other = (HeaderExchangeChannel) obj; if (channel == null) { - if (other.channel != null) return false; - } else if (!channel.equals(other.channel)) return false; + if (other.channel != null) { + return false; + } + } else if (!channel.equals(other.channel)) { + return false; + } return true; } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServer.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServer.java index 0b4aba0..8eceb18 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServer.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServer.java @@ -139,8 +139,9 @@ public class HeaderExchangeServer implements ExchangeServer { Collection<Channel> channels = getChannels(); for (Channel channel : channels) { try { - if (channel.isConnected()) + if (channel.isConnected()) { channel.send(request, getUrl().getParameter(Constants.CHANNEL_READONLYEVENT_SENT_KEY, true)); + } } catch (RemotingException e) { logger.warn("send cannot write message error.", e); } diff --git a/dubbo-remoting/dubbo-remoting-grizzly/src/main/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyClient.java b/dubbo-remoting/dubbo-remoting-grizzly/src/main/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyClient.java index a929af3..30f47b8 100644 --- a/dubbo-remoting/dubbo-remoting-grizzly/src/main/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyClient.java +++ b/dubbo-remoting/dubbo-remoting-grizzly/src/main/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyClient.java @@ -101,8 +101,9 @@ public class GrizzlyClient extends AbstractClient { @Override protected Channel getChannel() { Connection<?> c = connection; - if (c == null || !c.isOpen()) + if (c == null || !c.isOpen()) { return null; + } return GrizzlyChannel.getOrAddChannel(c, getUrl(), this); } diff --git a/dubbo-remoting/dubbo-remoting-mina/src/main/java/org/apache/dubbo/remoting/transport/mina/MinaClient.java b/dubbo-remoting/dubbo-remoting-mina/src/main/java/org/apache/dubbo/remoting/transport/mina/MinaClient.java index b2e4a6c..552becd 100644 --- a/dubbo-remoting/dubbo-remoting-mina/src/main/java/org/apache/dubbo/remoting/transport/mina/MinaClient.java +++ b/dubbo-remoting/dubbo-remoting-mina/src/main/java/org/apache/dubbo/remoting/transport/mina/MinaClient.java @@ -165,8 +165,9 @@ public class MinaClient extends AbstractClient { @Override protected Channel getChannel() { IoSession s = session; - if (s == null || !s.isConnected()) + if (s == null || !s.isConnected()) { return null; + } return MinaChannel.getOrAddChannel(s, getUrl(), this); } diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyChannel.java b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyChannel.java index 39de3d9..db69a29 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyChannel.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyChannel.java @@ -178,13 +178,23 @@ final class NettyChannel extends AbstractChannel { @Override public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } NettyChannel other = (NettyChannel) obj; if (channel == null) { - if (other.channel != null) return false; - } else if (!channel.equals(other.channel)) return false; + if (other.channel != null) { + return false; + } + } else if (!channel.equals(other.channel)) { + return false; + } return true; } diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectInputStream.java b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectInputStream.java index 2587e59..a6bda0a 100644 --- a/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectInputStream.java +++ b/dubbo-serialization/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectInputStream.java @@ -43,8 +43,9 @@ public class CompactedObjectInputStream extends ObjectInputStream { @Override protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { int type = read(); - if (type < 0) + if (type < 0) { throw new EOFException(); + } switch (type) { case 0: return super.readClassDescriptor();