關於Corba呼叫的Timeout 問題
關於Corba呼叫的Timeout 問題
在VisiBorker 下無論是C++ 還是 Java Corba 呼叫預設是沒有超時的。也就是說呼叫將阻塞到有返回為止
如果要配置 Timeout,就必須為Orb配置相關的Policy
C++ 如下配置
Messaging::RebindMode rebind_mode = QoSExt::VB_TRANSPARENT;
CORBA::Any rebind_value;
rebind_value <<= rebind_mode;
CORBA::Policy_var rebind_policy =
orb->create_policy(Messaging::REBIND_POLICY_TYPE,
rebind_value);
CORBA::Any con_timeout_value; // 設定Bind連線的時候的TimeOut
CORBA::Any snd_timeout_value; // 設定傳送時候的TimeOut
CORBA::Any rt_timeout_value; // 設定接收時候的TimeOut
// 5 seconds
con_timeout_value <<= (CORBA::ULongLong)(5 * 1000 * 10000);
snd_timeout_value <<= (CORBA::ULongLong)(5 * 1000 * 10000);
// 60 seconds
// note: rt = snd + rcv so rt > snd. if rt = snd, then it
// is effectively 0 and will not work.
rt_timeout_value <<= (CORBA::ULongLong)(15 * 1000 * 10000);
CORBA::Policy_var con_timeout_policy =
orb->create_policy(QoSExt::RELATIVE_CONN_TIMEOUT_POLICY_TYPE,
con_timeout_value);
CORBA::Policy_var snd_timeout_policy =
orb->create_policy(Messaging::RELATIVE_REQ_TIMEOUT_POLICY_TYPE,
snd_timeout_value);
CORBA::Policy_var rt_timeout_policy =
orb->create_policy(Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
rt_timeout_value);
CORBA::PolicyList policies;
policies.length(4);
policies[0] = CORBA::Policy::_duplicate(rebind_policy);
policies[1] = CORBA::Policy::_duplicate(con_timeout_policy);
policies[2] = CORBA::Policy::_duplicate(snd_timeout_policy);
policies[3] = CORBA::Policy::_duplicate(rt_timeout_policy);
// Install the policies at the orb level.
CORBA::Object_var obj =
orb->resolve_initial_references("ORBPolicyManager");
CORBA::PolicyManager_var orb_mgr =
CORBA::PolicyManager::_narrow(obj);
orb_mgr->set_policy_overrides(policies, CORBA::SET_OVERRIDE);
Java 下如下配置
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
short rebindMode = TRANSPARENT.value;
Any con_timeout_value = orb.create_any();
con_timeout_value.insert_ulonglong(5 * 1000 * 10000); // 5 seconds
Policy con_timeout_policy =
orb.create_policy(RELATIVE_CONN_TIMEOUT_POLICY_TYPE.value,
con_timeout_value);
Any snd_timeout_value = orb.create_any();
snd_timeout_value.insert_ulonglong(5 * 1000 * 10000); // 5 seconds
Policy snd_timeout_policy =
orb.create_policy(RELATIVE_REQ_TIMEOUT_POLICY_TYPE.value,
snd_timeout_value);
Any rt_timeout_value = orb.create_any();
rt_timeout_value.insert_long(15 * 1000 * 10000); // 15 seconds
Policy rt_timeout_policy =
orb.create_policy(RELATIVE_RT_TIMEOUT_POLICY_TYPE.value,
rt_timeout_value);
Any rebindValue = orb.create_any();
RebindModeHelper.insert(rebindValue, rebindMode);
Policy rebind_policy =
orb.create_policy(REBIND_POLICY_TYPE.value, rebindValue);
PolicyManager orbManager =
PolicyManagerHelper.narrow(
orb.resolve_initial_references("ORBPolicyManager"));
// Install the policy at the orb level.
orbManager.set_policy_overrides(
new Policy[] {rebind_policy, con_timeout_policy,
snd_timeout_policy, rt_timeout_policy},
SetOverrideType.SET_OVERRIDE);
[@more@]來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90000/viewspace-1043222/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 關於uniapp呼叫支付寶登入問題APP
- redis connect timeout問題排查Redis
- 關於this指向的問題
- 關於EL在JSP內呼叫RequestScope內建物件報錯的問題JS物件
- JQ AJAX 超時問題 timeout
- [React]setState呼叫過於頻繁的問題React
- 關於DrawerLayout的小問題
- 關於javascript的this指向問題JavaScript
- 關於 Puerts 的效能問題
- 關於盒模型相關的問題模型
- 【問題處理】IPC Send timeout detected
- 關於 Laravel 分頁的問題?Laravel
- [20191129]關於hugepages的問題.txt
- 關於hanlp2.0的問題HanLP
- 關於PHP佇列的問題PHP佇列
- 關於安裝nbextensions的問題
- 關於css權值的問題CSS
- 關於影像識別的問題
- 關於搜尋地址的問題
- libusb:libusb_bulk_transfer的timeout引數問題
- 解決 nginx 反向代理時的 upstream timeout 問題Nginx
- 關於PHP的OpenSSL的加密問題PHP加密
- 關於跨域問題跨域
- 關於問問題和時間管理的感悟
- 關於node服務部署的問題
- 關於Argument list too long的問題
- 關於爬蟲工具 colly 的問題爬蟲
- 有關於css中行高的問題CSS
- 關於我的雲棲打卡問題。
- 關於 Laravel 遷移遇到的問題Laravel
- 關於工作中遇到的問題
- 關於 PayPal 支付回撥的問題
- 關於Redis的一些小問題Redis
- [20181229]關於字串的分配問題.txt字串
- 關於cuda中的函式問題函式
- 關於Failed to resolve的問題解決AI
- 關於操作駁回遇到的問題
- 關於 Spartacus 的 sitemap.xml 問題XML
- 關於forEach同步非同步的問題非同步