use of org.omg.CORBA.PolicyManager in project ACS by ACS-Community.
the class AcsCorba method setORBLevelRoundtripTimeout.
/**
* Sets the roundtrip timeout for all calls going out through the ORB that is encapsulated by this class.
* For example, this applies to all corba calls made by a container and any of its components.
* @param timeoutSeconds
* @throws AcsJContainerServicesEx
* @see {@link #wrapForRoundtripTimeout(Object, double)}
*/
public void setORBLevelRoundtripTimeout(double timeoutSeconds) throws AcsJContainerServicesEx {
if (!isInitialized()) {
throw new IllegalStateException("Only call when this object has been initialized!");
}
try {
Any rrtPolicyAny = m_orb.create_any();
rrtPolicyAny.insert_ulonglong(UTCUtility.durationJavaMillisToOmg((long) timeoutSeconds * 1000));
Policy p = m_orb.create_policy(RELATIVE_RT_TIMEOUT_POLICY_TYPE.value, rrtPolicyAny);
// about PolicyManager, see Corba spec (2.4) section 4.9.1
PolicyManager pm = PolicyManagerHelper.narrow(m_orb.resolve_initial_references("ORBPolicyManager"));
pm.set_policy_overrides(new Policy[] { p }, SetOverrideType.SET_OVERRIDE);
p.destroy();
} catch (Throwable thr) {
AcsJContainerServicesEx ex2 = new AcsJContainerServicesEx(thr);
ex2.setContextInfo("Failed to set the ORB-level client-side corba roundtrip timeout to " + timeoutSeconds);
throw ex2;
}
m_logger.fine("Set ORB level roundtrip timeout to " + timeoutSeconds + " seconds.");
}
Aggregations