aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephan Siano (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (ARIES-1113) Double checked locking in BundleRevisionResource
Date Thu, 05 Sep 2013 06:04:51 GMT

     [ https://issues.apache.org/jira/browse/ARIES-1113?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Stephan Siano updated ARIES-1113:
---------------------------------

    Description: 
The class org.apache.aries.subsystem.core.internal.BundleRevisionResource contains the following
method:

{code}
private ParsedServiceElements getParsedServiceElements() {
  ParsedServiceElements result = elements;
  if (result == null) {
    synchronized (this) {
      result = elements;
      if (result == null)
        elements = result = computeParsedServiceElements();
    }
  }
  return result;
}
{code}

It is well known that this double checked locking ideom does not work. It should be changed
to something like

{code}
private synchronized ParsedServiceElements getParsedServiceElements() {
  if (elements == null)
    elements = computeParsedServiceElements();
  return elements;
}
{code}


  was:
The class org.apache.aries.subsystem.core.internal.BundleRevisionResource contains the following
method:

private ParsedServiceElements getParsedServiceElements() {
  ParsedServiceElements result = elements;
  if (result == null) {
    synchronized (this) {
      result = elements;
      if (result == null)
        elements = result = computeParsedServiceElements();
    }
  }
  return result;
}

It is well known that this double checked locking ideom does not work. It should be changed
to something like

private synchronized ParsedServiceElements getParsedServiceElements() {
  if (elements == null)
    elements = computeParsedServiceElements();
  return elements;
}

    
> Double checked locking in BundleRevisionResource
> ------------------------------------------------
>
>                 Key: ARIES-1113
>                 URL: https://issues.apache.org/jira/browse/ARIES-1113
>             Project: Aries
>          Issue Type: Bug
>          Components: Subsystem
>            Reporter: Stephan Siano
>
> The class org.apache.aries.subsystem.core.internal.BundleRevisionResource contains the
following method:
> {code}
> private ParsedServiceElements getParsedServiceElements() {
>   ParsedServiceElements result = elements;
>   if (result == null) {
>     synchronized (this) {
>       result = elements;
>       if (result == null)
>         elements = result = computeParsedServiceElements();
>     }
>   }
>   return result;
> }
> {code}
> It is well known that this double checked locking ideom does not work. It should be changed
to something like
> {code}
> private synchronized ParsedServiceElements getParsedServiceElements() {
>   if (elements == null)
>     elements = computeParsedServiceElements();
>   return elements;
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message