parent
b52879c4e1
commit
4bbc0dddda
|
|
@ -141,38 +141,27 @@ public class MergeableClusterInvoker<T> implements Invoker<T> {
|
|||
.append(" ]")
|
||||
.toString());
|
||||
}
|
||||
if (method != null) {
|
||||
if (!Modifier.isPublic(method.getModifiers())) {
|
||||
method.setAccessible(true);
|
||||
}
|
||||
result = resultList.remove(0).getValue();
|
||||
try {
|
||||
if (method.getReturnType() != void.class
|
||||
&& method.getReturnType().isAssignableFrom(result.getClass())) {
|
||||
for (Result r : resultList) {
|
||||
result = method.invoke(result, r.getValue());
|
||||
}
|
||||
} else {
|
||||
for (Result r : resultList) {
|
||||
method.invoke(result, r.getValue());
|
||||
}
|
||||
if (!Modifier.isPublic(method.getModifiers())) {
|
||||
method.setAccessible(true);
|
||||
}
|
||||
result = resultList.remove(0).getValue();
|
||||
try {
|
||||
if (method.getReturnType() != void.class
|
||||
&& method.getReturnType().isAssignableFrom(result.getClass())) {
|
||||
for (Result r : resultList) {
|
||||
result = method.invoke(result, r.getValue());
|
||||
}
|
||||
} else {
|
||||
for (Result r : resultList) {
|
||||
method.invoke(result, r.getValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RpcException(
|
||||
new StringBuilder(32)
|
||||
.append("Can not merge result: ")
|
||||
.append(e.getMessage()).toString(),
|
||||
e);
|
||||
}
|
||||
} else {
|
||||
} catch (Exception e) {
|
||||
throw new RpcException(
|
||||
new StringBuilder(32)
|
||||
.append("Can not merge result because missing method [ ")
|
||||
.append(merger)
|
||||
.append(" ] in class [ ")
|
||||
.append(returnType.getClass().getName())
|
||||
.append(" ]")
|
||||
.toString());
|
||||
.append("Can not merge result: ")
|
||||
.append(e.getMessage()).toString(),
|
||||
e);
|
||||
}
|
||||
} else {
|
||||
Merger resultMerger;
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ public final class JavaBeanDescriptor implements Serializable, Iterable<Map.Entr
|
|||
|
||||
public String getEnumPropertyName() {
|
||||
if (isEnumType()) {
|
||||
Object result = getProperty(ENUM_PROPERTY_NAME).toString();
|
||||
Object result = getProperty(ENUM_PROPERTY_NAME);
|
||||
return result == null ? null : result.toString();
|
||||
}
|
||||
throw new IllegalStateException("The instance is not a enum wrapper");
|
||||
|
|
|
|||
|
|
@ -330,7 +330,8 @@ public class ExtensionLoader<T> {
|
|||
if (name == null || name.length() == 0)
|
||||
throw new IllegalArgumentException("Extension name == null");
|
||||
try {
|
||||
return getExtensionClass(name) != null;
|
||||
this.getExtensionClass(name);
|
||||
return true;
|
||||
} catch (Throwable t) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class CollectionUtils {
|
|||
return null;
|
||||
}
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
if (list == null || list.isEmpty()) {
|
||||
if (list.isEmpty()) {
|
||||
return map;
|
||||
}
|
||||
for (String item : list) {
|
||||
|
|
@ -113,7 +113,7 @@ public class CollectionUtils {
|
|||
return null;
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
if (map == null || map.size() == 0) {
|
||||
if (map.size() == 0) {
|
||||
return list;
|
||||
}
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ public abstract class AbstractConfig implements Serializable {
|
|||
if (parameter == null || !parameter.attribute())
|
||||
continue;
|
||||
String key;
|
||||
if (parameter != null && parameter.key() != null && parameter.key().length() > 0) {
|
||||
if (parameter.key() != null && parameter.key().length() > 0) {
|
||||
key = parameter.key();
|
||||
} else {
|
||||
int i = name.startsWith("get") ? 3 : 2;
|
||||
|
|
|
|||
|
|
@ -395,13 +395,13 @@ public class MulticastRegistry extends FailbackRegistry {
|
|||
urls.addAll(values);
|
||||
}
|
||||
}
|
||||
if (urls == null || urls.isEmpty()) {
|
||||
if (urls.isEmpty()) {
|
||||
List<URL> cacheUrls = getCacheUrls(url);
|
||||
if (cacheUrls != null && !cacheUrls.isEmpty()) {
|
||||
urls.addAll(cacheUrls);
|
||||
}
|
||||
}
|
||||
if (urls == null || urls.isEmpty()) {
|
||||
if (urls.isEmpty()) {
|
||||
for (URL u : getRegistered()) {
|
||||
if (UrlUtils.isMatch(url, u)) {
|
||||
urls.add(u);
|
||||
|
|
|
|||
|
|
@ -260,18 +260,14 @@ public class TelnetCodec extends TransportCodec {
|
|||
String value = history.get(index);
|
||||
if (value != null) {
|
||||
byte[] b1 = value.getBytes();
|
||||
if (message != null && message.length > 0) {
|
||||
byte[] b2 = new byte[b1.length + message.length];
|
||||
System.arraycopy(b1, 0, b2, 0, b1.length);
|
||||
System.arraycopy(message, 0, b2, b1.length, message.length);
|
||||
message = b2;
|
||||
} else {
|
||||
message = b1;
|
||||
}
|
||||
byte[] b2 = new byte[b1.length + message.length];
|
||||
System.arraycopy(b1, 0, b2, 0, b1.length);
|
||||
System.arraycopy(message, 0, b2, b1.length, message.length);
|
||||
message = b2;
|
||||
}
|
||||
}
|
||||
String result = toString(message, getCharset(channel));
|
||||
if (result != null && result.trim().length() > 0) {
|
||||
if (result.trim().length() > 0) {
|
||||
if (history == null) {
|
||||
history = new LinkedList<String>();
|
||||
channel.setAttribute(HISTORY_LIST_KEY, history);
|
||||
|
|
|
|||
|
|
@ -91,9 +91,9 @@ public class DubboProtocol extends AbstractProtocol {
|
|||
}
|
||||
}
|
||||
if (!hasMethod) {
|
||||
logger.warn(new IllegalStateException("The methodName " + inv.getMethodName()
|
||||
logger.warn(new IllegalStateException("The methodName " + inv.getMethodName()
|
||||
+ " not found in callback service interface ,invoke will be ignored."
|
||||
+ " please update the api interface. url is:"
|
||||
+ " please update the api interface. url is:"
|
||||
+ invoker.getUrl()) + " ,invocation is :" + inv);
|
||||
return null;
|
||||
}
|
||||
|
|
@ -101,8 +101,8 @@ public class DubboProtocol extends AbstractProtocol {
|
|||
RpcContext.getContext().setRemoteAddress(channel.getRemoteAddress());
|
||||
return invoker.invoke(inv);
|
||||
}
|
||||
throw new RemotingException(channel, "Unsupported request: "
|
||||
+ (message == null ? null : (message.getClass().getName() + ": " + message))
|
||||
throw new RemotingException(channel, "Unsupported request: "
|
||||
+ (message == null ? null : (message.getClass().getName() + ": " + message))
|
||||
+ ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public class FutureFilter implements Filter {
|
|||
if (onInvokeMethod == null || onInvokeInst == null) {
|
||||
throw new IllegalStateException("service:" + invoker.getUrl().getServiceKey() + " has a onreturn callback config , but no such " + (onInvokeMethod == null ? "method" : "instance") + " found. url:" + invoker.getUrl());
|
||||
}
|
||||
if (onInvokeMethod != null && !onInvokeMethod.isAccessible()) {
|
||||
if (!onInvokeMethod.isAccessible()) {
|
||||
onInvokeMethod.setAccessible(true);
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ public class FutureFilter implements Filter {
|
|||
if (onReturnMethod == null || onReturnInst == null) {
|
||||
throw new IllegalStateException("service:" + invoker.getUrl().getServiceKey() + " has a onreturn callback config , but no such " + (onReturnMethod == null ? "method" : "instance") + " found. url:" + invoker.getUrl());
|
||||
}
|
||||
if (onReturnMethod != null && !onReturnMethod.isAccessible()) {
|
||||
if (!onReturnMethod.isAccessible()) {
|
||||
onReturnMethod.setAccessible(true);
|
||||
}
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ public class FutureFilter implements Filter {
|
|||
if (onthrowMethod == null || onthrowInst == null) {
|
||||
throw new IllegalStateException("service:" + invoker.getUrl().getServiceKey() + " has a onthrow callback config , but no such " + (onthrowMethod == null ? "method" : "instance") + " found. url:" + invoker.getUrl());
|
||||
}
|
||||
if (onthrowMethod != null && !onthrowMethod.isAccessible()) {
|
||||
if (!onthrowMethod.isAccessible()) {
|
||||
onthrowMethod.setAccessible(true);
|
||||
}
|
||||
Class<?>[] rParaTypes = onthrowMethod.getParameterTypes();
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ public class HttpProtocol extends AbstractProxyProtocol {
|
|||
HttpComponentsHttpInvokerRequestExecutor httpInvokerRequestExecutor = new HttpComponentsHttpInvokerRequestExecutor();
|
||||
httpInvokerRequestExecutor.setReadTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
|
||||
httpProxyFactoryBean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor);
|
||||
} else if (client != null && client.length() > 0) {
|
||||
} else {
|
||||
throw new IllegalStateException("Unsupported http protocol client " + client + ", only supported: simple, commons");
|
||||
}
|
||||
httpProxyFactoryBean.afterPropertiesSet();
|
||||
|
|
|
|||
Loading…
Reference in New Issue