Github user DaanHoogland commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1532#discussion_r62456988
  
    --- Diff: framework/db/src/com/cloud/utils/db/GenericDaoBase.java ---
    @@ -969,7 +969,12 @@ public T findByUuidIncludingRemoved(final String uuid) 
{
         @Override
         @DB()
         public T findByIdIncludingRemoved(ID id) {
    -        return findById(id, true, null);
    +        if (_cache != null) {
    +            final Element element = _cache.get(id);
    +            return element == null ? findById(id, true, null) : 
(T)element.getObjectValue();
    +        } else {
    --- End diff --
    
    @marcaurele good point so to address your concern:
    ```
    T result = null
    if (_cache != null) {
        final Element element = _cache.get(id);
        if (element != null) {
            result = (T)element.getObjectValue();
        }
    } else {
        result =findById(id, true, null);
    }
    return result;
    ```
     this also implements the good practice of having only one return in the 
method. I am not hellbound on these changes however. As the method is so small 
it would be merely cosmetic.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to