|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.baidu.driver4j.bns.BNSQueryAgentProxy
public class BNSQueryAgentProxy
BNS query proxy which query from BNS agent supports.
| 方法摘要 | |
|---|---|
protected byte[] |
doRequest(String host,
int port,
byte[] requestBodyBytes,
short requestMsgType,
short expectResponseType,
int timeoutMs)
Communicate with target host |
List<Instance> |
getAuthInstanceByService(String serviceName)
Get the Instances that are configured in Auth Config on noah.baidu.com This functionality is used to ease the managing of the so called white ip list. |
List<Instance> |
getAuthInstanceByService(String serviceName,
int timeoutMs)
Get the Instances that are configured in Auth Config on noah.baidu.com This functionality is used to ease the managing of the so called white ip list. |
protected byte[] |
getBNSMsgBytes(byte[] requestBodyBytes,
short requestMsgType)
|
BNSQueryProxy |
getBnsQueryProxy()
Gets the bns query proxy. |
static String |
getDefaultGateway()
|
List<Instance> |
getInstanceByService(String serviceName)
Get the instances list of given serviceName. |
List<Instance> |
getInstanceByService(String serviceName,
int timeoutMs)
Get the instances list of given serviceName. |
Instance |
getInstanceByService(String serviceName,
SelectionStrategy strategy)
Get only one instance by SelectionStrategy. |
Instance |
getInstanceByService(String serviceName,
SelectionStrategy strategy,
int timeout)
Get only one instance by SelectionStrategy. |
static String |
getLocalNamedAddress()
|
Service |
getService(String serviceName)
Get the Service object by noah service name. |
Service |
getService(String serviceName,
int timeoutMs)
Get the Service object first it will query from local agent then try to query from remote agent, at last
query from HTTP API |
static BNSQueryAgentProxy |
proxy()
|
static BNSQueryAgentProxy |
proxy(BNSQueryProxy proxy)
|
static BNSQueryAgentProxy |
proxy(String bnsServiceUrl)
|
List<Instance> |
queryInstances(String serviceName)
|
protected byte[] |
readBNSMsg(InputStream is,
short expectResponseType)
|
protected Instance |
selectOneByStrategy(List<Instance> instances,
SelectionStrategy strategy)
To select only one instance by SelectionStrategy. or return null if a empty instances list. |
void |
setConnectTimeout(int connectTimeout)
setter method for property connectTimeout |
void |
setReadTimeout(int readTimeout)
setter method for property readTimeout |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 方法详细信息 |
|---|
public static BNSQueryAgentProxy proxy()
public static BNSQueryAgentProxy proxy(String bnsServiceUrl)
public static BNSQueryAgentProxy proxy(BNSQueryProxy proxy)
public void setConnectTimeout(int connectTimeout)
connectTimeout - the connectTimeout to setpublic void setReadTimeout(int readTimeout)
readTimeout - the readTimeout to set
public Instance getInstanceByService(String serviceName,
SelectionStrategy strategy)
throws BNSException
SelectionStrategy.
serviceName - service namestrategy - SelectionStrategy.
Instance object
BNSException - in case of access BNS server failed
public Instance getInstanceByService(String serviceName,
SelectionStrategy strategy,
int timeout)
throws BNSException
SelectionStrategy.
serviceName - service namestrategy - SelectionStrategy.timeout - time out on reading
Instance object
BNSException - in case of access BNS server failed
protected Instance selectOneByStrategy(List<Instance> instances,
SelectionStrategy strategy)
SelectionStrategy. or return null if a empty instances list.
instances - target instance liststrategy - SelectionStrategy instance
Instance object
public List<Instance> getInstanceByService(String serviceName)
throws BNSException
serviceName -
BNSException - in case of access BNS server failedgetInstanceByService(String, int)
public List<Instance> getInstanceByService(String serviceName,
int timeoutMs)
throws BNSException
serviceName - timeoutMs - minimum is 500ms
BNSException - in case of access BNS server failed
public List<Instance> getAuthInstanceByService(String serviceName)
throws BNSException
serviceName - , usually your service name
BNSException - when error occurs.getAuthInstanceByService(String, int)
public List<Instance> getAuthInstanceByService(String serviceName,
int timeoutMs)
throws BNSException
serviceName - , usually your service nametimeoutMs - in ms minimum is 500ms
BNSException - when error occurs.public Service getService(String serviceName)
Service object by noah service name.
serviceName - serivce nametimeoutMs - minimum is 500ms
Service instancegetService(String, int)
public Service getService(String serviceName,
int timeoutMs)
Service object first it will query from local agent then try to query from remote agent, at last
query from HTTP API
serviceName - serivce nametimeoutMs - minimum is 500ms
Service instance
protected byte[] doRequest(String host,
int port,
byte[] requestBodyBytes,
short requestMsgType,
short expectResponseType,
int timeoutMs)
throws BNSException
host - host nameport - port numberrequestBodyBytes - request bytesrequestMsgType - request typeexpectResponseType - response typetimeoutMs - read time out
BNSException - in case of access BNS service failed
protected byte[] getBNSMsgBytes(byte[] requestBodyBytes,
short requestMsgType)
throws IOException
IOException
protected byte[] readBNSMsg(InputStream is,
short expectResponseType)
throws IOException
IOExceptionpublic static String getLocalNamedAddress()
public static String getDefaultGateway()
public List<Instance> queryInstances(String serviceName)
throws BNSException
InstanceQuery 中的 queryInstancesBNSExceptionpublic BNSQueryProxy getBnsQueryProxy()
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||