I'm trying to implement a client timeout policy for a CORBA connection using JacORB with java. Following is the first method I tried to implement this
long timeout = 10000000L;
org.omg.CORBA.Any relativeRoundtripTimeoutValue = orb.create_any();
TimeTHelper.insert(relativeRoundtripTimeoutValue,timeout);
Policy[] policies = new Policy[1];
try {
policies[0] = orb.create_policy(org.omg.Messaging.RELATIVE_RT_TIMEOUT_POLICY_TYPE.value,
relativeRoundtripTimeoutValue);
<client_stub>._set_policy_override(policies, SetOverrideType.ADD_OVERRIDE);
} catch (PolicyError e) {
e.printStackTrace();
}
This implementation throws
Caused by: org.omg.CORBA.BAD_OPERATION: Cannot extract ulonglong vmcid: 0x0 minor code: 0 completed: No
at org.jacorb.orb.Any.checkExtract(Any.java:118)
at org.jacorb.orb.Any.extract_ulonglong(Any.java:467)
at org.jacorb.orb.policies.RelativeRoundtripTimeoutPolicy.<init>(RelativeRoundtripTimeoutPolicy.java:58)
at org.jacorb.orb.ORB.create_policy(ORB.java:774)
But when I change RELATIVE_RT_TIMEOUT_POLICY_TYPE to REPLY_END_TIME_POLICY_TYPE this runs without an exception but did not yield the expected result as client waited without timing out.
I tried following approach also and it ran without an exception but again the client waited indefinitely without timing out.
Policy retquestTimeoutPolicy = new org.jacorb.orb.policies.RelativeRoundtripTimeoutPolicy (1000 * 10000);
applicationDataAccess._set_policy_override(new Policy[]{retquestTimeoutPolicy}, SetOverrideType.ADD_OVERRIDE);
I may be missing some small thing here but I'm new to corba flows. so any help will be great.
When you set an override it applies to the new object e.g.
new_object_with_policy = applicationDataAccess._set_policy_override(....
Try doing that ?