Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.7.3
-
None
-
None
-
ANY
Description
Currently it is not possibel to get a ServiceGroupContext from the ConfigurationContext without forcing a touch to the 'lastTouchedTime'.
This prevents us from performing our own checks against the lastTouchedTime because it is always set to the System time ("Observer Effect" - by observing the system, we change the system).
I would propose a second API method which would allow retrieval of the ServiceGroupContext by id without touching the lastTouchedTime.
Here my proposed code change:
/** * Returns a ServiceGroupContext object associated with the specified ID from the internal table. * <p> * If found, the returned {@code ServiceGroupContext} will be touched with the current system time. * * @param serviceGroupCtxId The ID string associated with the ServiceGroupContext object * @return The ServiceGroupContext object, or {@code null} if not found */ public ServiceGroupContext getServiceGroupContext(String serviceGroupCtxId) { return getServiceGroupContext(serviceGroupCtxId, true); } /** * Returns a ServiceGroupContext object associated with the specified ID from the internal table. * * @param serviceGroupCtxId The ID string associated with the ServiceGroupContext object * @param touchServiceGroupContext if {@code true} the retrieved {@code ServiceGroupContext} will be touched on * retrieval; otherwise, {@code false}. * @return the ServiceGroupContext object, or {@code null} if not found */ public ServiceGroupContext getServiceGroupContext(String serviceGroupCtxId, boolean touchServiceGroupContext) { if (serviceGroupCtxId == null) { // Hashtables require non-null key-value pairs return null; } ServiceGroupContext serviceGroupContext = null; if (serviceGroupContextMap != null) { serviceGroupContext =serviceGroupContextMap.get(serviceGroupCtxId); if (serviceGroupContext != null && touchServiceGroupContext) { serviceGroupContext.touch(); } else { serviceGroupContext =applicationSessionServiceGroupContexts .get(serviceGroupCtxId); if (serviceGroupContext != null && touchServiceGroupContext) { serviceGroupContext.touch(); } } } return serviceGroupContext; }
Side note: the javadoc of getServiceGroupContextIDs is incorrect. The method returns a String[] array of ids and not a hashmap of ServiceGroupContexts.
/** * Gets all service groups in the system. * * @return Returns hashmap of ServiceGroupContexts. */ public String[] getServiceGroupContextIDs() {