[
https://issues.apache.org/jira/browse/AXIS2-5788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Lazarski reassigned AXIS2-5788:
--------------------------------------
Assignee: Robert Lazarski
> ConfigurationContext.getServiceGroupContext(id) always touches the id -
> ("Observer Effect")
> -------------------------------------------------------------------------------------------
>
> Key: AXIS2-5788
> URL: https://issues.apache.org/jira/browse/AXIS2-5788
> Project: Axis2
> Issue Type: Bug
> Components: kernel
> Affects Versions: 1.7.3
> Environment: ANY
> Reporter: Jeff Thomas
> Assignee: Robert Lazarski
> Priority: Major
> Fix For: 2.0.1
>
>
> 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:
> {code:java}
> /**
> * 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;
>
> }
> {code}
> Side note: the javadoc of getServiceGroupContextIDs is incorrect. The method
> returns a String[] array of ids and not a hashmap of ServiceGroupContexts.
> {code:java}
> /**
> * Gets all service groups in the system.
> *
> * @return Returns hashmap of ServiceGroupContexts.
> */
> public String[] getServiceGroupContextIDs() {
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]