public class MotanFrameworkUtil extends Object
| 构造器和说明 |
|---|
MotanFrameworkUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Response |
buildErrorResponse(long requestId,
Exception e) |
static boolean |
checkIfCanShallClientChannel(URL source,
URL target)
判断url:source和url:target是否可以使用共享的client channel(port) 对外提供服务
1) protocol
2) codec
3) serialize
4) maxContentLength
5) maxClientConnection
6) heartbeatFactory
|
static boolean |
checkIfCanShallServiceChannel(URL source,
URL target)
判断url:source和url:target是否可以使用共享的service channel(port) 对外提供服务
1) protocol
2) codec
3) serialize
4) maxContentLength
5) maxServerConnection
6) maxWorkerThread
7) workerQueueSize
8) heartbeatFactory
|
static ProtocolConfig |
getDefaultProtocolConfig()
获取默认motan协议配置
|
static RegistryConfig |
getDefaultRegistryConfig()
默认本地注册中心
|
static String |
getFullMethodString(Request request)
根据Request得到 interface.method(paramDesc) 的 desc
比如:
package com.weibo.api.motan;
interface A { public hello(int age); }
那么return "com.weibo.api.motan.A.hell(int)"
|
static String |
getGroupFromRequest(Request request) |
static String |
getGroupMethodString(Request request) |
static String |
getProtocolKey(URL url)
protocol key: protocol://host:port/group/interface/version
|
static String |
getServiceKey(Request request)
目前根据 group/interface/version 来唯一标示一个服务
|
static String |
getServiceKey(URL url)
目前根据 group/interface/version 来唯一标示一个服务
|
static String |
getValueFromRequest(Request request,
String key,
String defaultValue) |
static String |
getVersionFromRequest(Request request) |
static String |
removeAsyncSuffix(String path) |
static String |
toString(Request request)
输出请求的关键信息: requestId=** interface=** method=**(**)
|
public static String getServiceKey(Request request)
request - public static String getValueFromRequest(Request request, String key, String defaultValue)
public static String getServiceKey(URL url)
url - public static String getProtocolKey(URL url)
url - public static String toString(Request request)
request - public static String getFullMethodString(Request request)
比如:
package com.weibo.api.motan;
interface A { public hello(int age); }
那么return "com.weibo.api.motan.A.hell(int)"
request - public static boolean checkIfCanShallServiceChannel(URL source, URL target)
1) protocol
2) codec
3) serialize
4) maxContentLength
5) maxServerConnection
6) maxWorkerThread
7) workerQueueSize
8) heartbeatFactory
source - target - public static boolean checkIfCanShallClientChannel(URL source, URL target)
1) protocol
2) codec
3) serialize
4) maxContentLength
5) maxClientConnection
6) heartbeatFactory
source - target - public static ProtocolConfig getDefaultProtocolConfig()
public static RegistryConfig getDefaultRegistryConfig()
Copyright © 2017. All rights reserved.