public class MotanFrameworkUtil extends Object
| 构造器和说明 |
|---|
MotanFrameworkUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static DefaultResponse |
buildErrorResponse(long requestId,
byte version,
Exception e) |
static DefaultResponse |
buildErrorResponse(Request request,
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 |
checkIfCanShareServiceChannel(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
9) providerProtectedStrategy
|
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 |
getModuleOrGroup(Map<String,String> map,
String defaultValue)
Get the module first, or get the group if module not set
|
static String |
getProtocolKey(URL url)
protocol key: protocol://host:port/group/interface/version
|
static String |
getRemoteIpFromRequest(Request request) |
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 void |
logEvent(Request request,
String event) |
static void |
logEvent(Request request,
String event,
long time) |
static void |
logEvent(Response response,
String event) |
static void |
logEvent(Response response,
String event,
long time) |
static String |
removeAsyncSuffix(String path) |
static String |
toString(Request request)
输出请求的关键信息: requestId=** interface=** method=**(**)
|
static String |
toStringWithRemoteIp(Request request) |
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 String getModuleOrGroup(Map<String,String> map, String defaultValue)
map - URL's parameters or request's attachmentsdefaultValue - The default value when neither module nor group can be obtainedpublic static boolean checkIfCanShareServiceChannel(URL source, URL target)
1) protocol
2) codec
3) serialize
4) maxContentLength
5) maxServerConnection
6) maxWorkerThread
7) workerQueueSize
8) heartbeatFactory
9) providerProtectedStrategy
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()
public static DefaultResponse buildErrorResponse(Request request, Exception e)
public static DefaultResponse buildErrorResponse(long requestId, byte version, Exception e)
Copyright © 2023. All rights reserved.