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