Author: cziegeler
Date: Sun Oct 16 09:52:27 2016
New Revision: 1765129

URL: http://svn.apache.org/viewvc?rev=1765129&view=rev
Log:
SLING-4867 : EntityResourceList should be thread-safe

Modified:
    
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
    
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
    
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java

Modified: 
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java?rev=1765129&r1=1765128&r2=1765129&view=diff
==============================================================================
--- 
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
 (original)
+++ 
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
 Sun Oct 16 09:52:27 2016
@@ -62,6 +62,9 @@ public class EntityResourceList implemen
     /** The resource id of this group. */
     private String resourceId;
 
+    /** Lock */
+    private final Object lock = new Object();
+
     /** The listener. */
     private transient InstallationListener listener;
 
@@ -108,25 +111,31 @@ public class EntityResourceList implemen
             this.alias = (String)in.readObject();
             this.resourceId = (String)in.readObject();
         }
+        Util.setField(this, "lock", new Object());
     }
 
     /**
      * The resource list is empty if it contains no resources.
      */
     public boolean isEmpty() {
-        return resources.isEmpty();
+        synchronized ( lock ) {
+            return resources.isEmpty();
+        }
     }
 
     /**
      * @see 
org.apache.sling.installer.api.tasks.TaskResourceGroup#getActiveResource()
      */
+    @Override
     public TaskResource getActiveResource() {
-        if ( !resources.isEmpty() ) {
-            Collections.sort(this.resources);
-            final TaskResource r = resources.get(0);
-            if ( r.getState() == ResourceState.INSTALL
-                    || r.getState() == ResourceState.UNINSTALL ) {
-                return r;
+        synchronized ( lock ) {
+            if ( !resources.isEmpty() ) {
+                Collections.sort(this.resources);
+                final TaskResource r = resources.get(0);
+                if ( r.getState() == ResourceState.INSTALL
+                        || r.getState() == ResourceState.UNINSTALL ) {
+                    return r;
+                }
             }
         }
         return null;
@@ -135,14 +144,16 @@ public class EntityResourceList implemen
     /**
      * @see 
org.apache.sling.installer.api.tasks.TaskResourceGroup#getNextActiveResource()
      */
+    @Override
     public TaskResource getNextActiveResource() {
-        if ( this.getActiveResource() != null ) {
-            if ( this.resources.size() > 1 ) {
-                Collections.sort(this.resources);
-                // to get the second item in the set we have to use an 
iterator!
-                final Iterator<RegisteredResourceImpl> i = 
this.resources.iterator();
-                i.next(); // skip first
-                return i.next();
+        synchronized ( lock ) {
+            if ( this.getActiveResource() != null ) {
+                if ( this.resources.size() > 1 ) {
+                    // to get the second item in the set we have to use an 
iterator!
+                    final Iterator<RegisteredResourceImpl> i = 
this.resources.iterator();
+                    i.next(); // skip first
+                    return i.next();
+                }
             }
         }
         return null;
@@ -151,9 +162,11 @@ public class EntityResourceList implemen
      * Return the first resource or null
      */
     public TaskResource getFirstResource() {
-        if ( !resources.isEmpty() ) {
-            Collections.sort(this.resources);
-            return resources.get(0);
+        synchronized ( lock ) {
+            if ( !resources.isEmpty() ) {
+                Collections.sort(this.resources);
+                return resources.get(0);
+            }
         }
         return null;
     }
@@ -161,6 +174,7 @@ public class EntityResourceList implemen
     /**
      * Get the alias for this group or null
      */
+    @Override
     public String getAlias() {
         return this.alias;
     }
@@ -209,70 +223,74 @@ public class EntityResourceList implemen
     /**
      * @see 
org.apache.sling.installer.api.tasks.TaskResourceGroup#setFinishState(org.apache.sling.installer.api.tasks.ResourceState)
      */
+    @Override
     public void setFinishState(ResourceState state) {
         final TaskResource toActivate = getActiveResource();
         if ( toActivate != null ) {
-            if ( toActivate.getState() == ResourceState.UNINSTALL
-                 && this.resources.size() > 1 ) {
-
-                final TaskResource second = this.getNextActiveResource();
-                // check for template
-                if ( second.getDictionary() != null
-                     && 
second.getDictionary().get(InstallableResource.RESOURCE_IS_TEMPLATE) != null ) {
-                    // second resource is a template! Do not install
-                    
((RegisteredResourceImpl)second).setState(ResourceState.IGNORED);
-                } else if ( state == ResourceState.UNINSTALLED ) {
-                    // first resource got uninstalled, go back to second
-                    if (second.getState() == ResourceState.IGNORED || 
second.getState() == ResourceState.INSTALLED) {
-                        LOGGER.debug("Reactivating for next cycle: {}", 
second);
-                        
((RegisteredResourceImpl)second).setState(ResourceState.INSTALL);
-                    }
-                } else {
-                    // don't install as the first did not get uninstalled
-                    if ( second.getState() == ResourceState.INSTALL ) {
+            synchronized ( lock ) {
+                if ( toActivate.getState() == ResourceState.UNINSTALL
+                     && this.resources.size() > 1 ) {
+
+                    final TaskResource second = this.getNextActiveResource();
+                    // check for template
+                    if ( second.getDictionary() != null
+                         && 
second.getDictionary().get(InstallableResource.RESOURCE_IS_TEMPLATE) != null ) {
+                        // second resource is a template! Do not install
                         
((RegisteredResourceImpl)second).setState(ResourceState.IGNORED);
+                    } else if ( state == ResourceState.UNINSTALLED ) {
+                        // first resource got uninstalled, go back to second
+                        if (second.getState() == ResourceState.IGNORED || 
second.getState() == ResourceState.INSTALLED) {
+                            LOGGER.debug("Reactivating for next cycle: {}", 
second);
+                            
((RegisteredResourceImpl)second).setState(ResourceState.INSTALL);
+                        }
+                    } else {
+                        // don't install as the first did not get uninstalled
+                        if ( second.getState() == ResourceState.INSTALL ) {
+                            
((RegisteredResourceImpl)second).setState(ResourceState.IGNORED);
+                        }
+                        // and now set resource to uninstalled
+                        state = ResourceState.UNINSTALLED;
                     }
-                    // and now set resource to uninstalled
-                    state = ResourceState.UNINSTALLED;
-                }
-            } else if ( state == ResourceState.INSTALLED ) {
-                // make sure that no other resource has state INSTALLED
-                if ( this.resources.size() > 1 ) {
-                    // to get the second item in the set we have to use an 
iterator!
-                    final Iterator<RegisteredResourceImpl> i = 
this.resources.iterator();
-                    i.next(); // skip first
-                    while ( i.hasNext() ) {
-                        final TaskResource rsrc = i.next();
-                        if ( rsrc.getState() == ResourceState.INSTALLED ) {
-                            
((RegisteredResourceImpl)rsrc).setState(ResourceState.INSTALL);
+                } else if ( state == ResourceState.INSTALLED ) {
+                    // make sure that no other resource has state INSTALLED
+                    if ( this.resources.size() > 1 ) {
+                        // to get the second item in the set we have to use an 
iterator!
+                        final Iterator<RegisteredResourceImpl> i = 
this.resources.iterator();
+                        i.next(); // skip first
+                        while ( i.hasNext() ) {
+                            final TaskResource rsrc = i.next();
+                            if ( rsrc.getState() == ResourceState.INSTALLED ) {
+                                
((RegisteredResourceImpl)rsrc).setState(ResourceState.INSTALL);
+                            }
                         }
                     }
-                }
 
-            }
-            ((RegisteredResourceImpl)toActivate).setState(state);
+                }
+                ((RegisteredResourceImpl)toActivate).setState(state);
 
-            if ( state != ResourceState.INSTALLED ) {
-                // make sure to remove all install info attributes if the 
resource is not
-                // installed anymore
-                toActivate.setAttribute(TaskResource.ATTR_INSTALL_EXCLUDED, 
null);
-                toActivate.setAttribute(TaskResource.ATTR_INSTALL_INFO, null);
-            }
-            // remove install info attributes on all other resources in the 
group
-            final Iterator<RegisteredResourceImpl> tri = 
this.resources.iterator();
-            tri.next(); // skip first
-            while ( tri.hasNext() ) {
-                final TaskResource rsrc = tri.next();
-                rsrc.setAttribute(TaskResource.ATTR_INSTALL_EXCLUDED, null);
-                rsrc.setAttribute(TaskResource.ATTR_INSTALL_INFO, null);
+                if ( state != ResourceState.INSTALLED ) {
+                    // make sure to remove all install info attributes if the 
resource is not
+                    // installed anymore
+                    
toActivate.setAttribute(TaskResource.ATTR_INSTALL_EXCLUDED, null);
+                    toActivate.setAttribute(TaskResource.ATTR_INSTALL_INFO, 
null);
+                }
+                // remove install info attributes on all other resources in 
the group
+                final Iterator<RegisteredResourceImpl> tri = 
this.resources.iterator();
+                tri.next(); // skip first
+                while ( tri.hasNext() ) {
+                    final TaskResource rsrc = tri.next();
+                    rsrc.setAttribute(TaskResource.ATTR_INSTALL_EXCLUDED, 
null);
+                    rsrc.setAttribute(TaskResource.ATTR_INSTALL_INFO, null);
+                }
             }
-
             this.listener.onEvent(new InstallationEvent() {
 
+                @Override
                 public TYPE getType() {
                     return TYPE.PROCESSED;
                 }
 
+                @Override
                 public Object getSource() {
                     return toActivate;
                 }
@@ -286,6 +304,7 @@ public class EntityResourceList implemen
     /**
      * @see 
org.apache.sling.installer.api.tasks.TaskResourceGroup#setFinishState(org.apache.sling.installer.api.tasks.ResourceState,
 java.lang.String)
      */
+    @Override
     public void setFinishState(final ResourceState state, final String alias) {
         this.alias = alias;
         this.setFinishState(state);
@@ -297,67 +316,83 @@ public class EntityResourceList implemen
         }
     }
 
+    public Collection<RegisteredResourceImpl> listResources() {
+        synchronized ( lock ) {
+            Collections.sort(this.resources);
+            return resources;
+        }
+    }
+
     public Collection<RegisteredResourceImpl> getResources() {
-        Collections.sort(this.resources);
-        return resources;
+        final List<RegisteredResourceImpl> list;
+        synchronized ( lock ) {
+            list = new ArrayList<RegisteredResourceImpl>(this.resources);
+        }
+        Collections.sort(list);
+        return list;
     }
 
     public void addOrUpdate(final RegisteredResourceImpl r) {
-        LOGGER.debug("Adding new resource: {}", r);
-        Collections.sort(this.resources);
-        // If an object with same url is already present, replace with the
-        // new one which might have different attributes
-        boolean first = true;
-        boolean add = true;
-        final Iterator<RegisteredResourceImpl> taskIter = 
this.resources.iterator();
-        while ( taskIter.hasNext() ) {
-            final TaskResource rr = taskIter.next();
-            if ( rr.getURL().equals(r.getURL()) ) {
-                if ( 
RegisteredResourceImpl.isSameResource((RegisteredResourceImpl)rr, r) ) {
-                    if ( !rr.getDigest().equals(r.getDigest()) ) {
-                        // same resource but different digest, we need to 
remove the file
-                        LOGGER.debug("Cleanup duplicate resource: {}", r);
-                        this.cleanup(r);
-                    }
-                    // same resource, just ignore the new one
-                    add = false;
-                } else {
-                    if ( first && rr.getState() == ResourceState.INSTALLED) {
-                        // it's not the same, but the first one is installed, 
so uninstall
-                        
((RegisteredResourceImpl)rr).setState(ResourceState.UNINSTALL);
+        synchronized ( lock ) {
+            LOGGER.debug("Adding new resource: {}", r);
+            Collections.sort(this.resources);
+            // If an object with same url is already present, replace with the
+            // new one which might have different attributes
+            boolean first = true;
+            boolean add = true;
+            final Iterator<RegisteredResourceImpl> taskIter = 
this.resources.iterator();
+            while ( taskIter.hasNext() ) {
+                final TaskResource rr = taskIter.next();
+                if ( rr.getURL().equals(r.getURL()) ) {
+                    if ( 
RegisteredResourceImpl.isSameResource((RegisteredResourceImpl)rr, r) ) {
+                        if ( !rr.getDigest().equals(r.getDigest()) ) {
+                            // same resource but different digest, we need to 
remove the file
+                            LOGGER.debug("Cleanup duplicate resource: {}", r);
+                            this.cleanup(r);
+                        }
+                        // same resource, just ignore the new one
+                        add = false;
                     } else {
-                        LOGGER.debug("Cleanup obsolete resource: {}", rr);
-                        taskIter.remove();
-                        this.cleanup(rr);
+                        if ( first && rr.getState() == 
ResourceState.INSTALLED) {
+                            // it's not the same, but the first one is 
installed, so uninstall
+                            
((RegisteredResourceImpl)rr).setState(ResourceState.UNINSTALL);
+                        } else {
+                            LOGGER.debug("Cleanup obsolete resource: {}", rr);
+                            taskIter.remove();
+                            this.cleanup(rr);
+                        }
                     }
+                    break;
                 }
-                break;
+                first = false;
+            }
+            if ( add ) {
+                resources.add(r);
+                Collections.sort(this.resources);
             }
-            first = false;
-        }
-        if ( add ) {
-            resources.add(r);
         }
     }
 
     public void remove(final String url) {
-        Collections.sort(this.resources);
-        final Iterator<RegisteredResourceImpl> i = resources.iterator();
-        boolean first = true;
-        while ( i.hasNext() ) {
-            final TaskResource r = i.next();
-            if ( r.getURL().equals(url) ) {
-                if ( first && (r.getState() == ResourceState.INSTALLED
-                        || r.getState() == ResourceState.INSTALL)) {
-                    LOGGER.debug("Marking for uninstalling: {}", r);
-                    
((RegisteredResourceImpl)r).setState(ResourceState.UNINSTALL);
-                } else {
-                    LOGGER.debug("Removing unused: {}", r);
-                    i.remove();
-                    this.cleanup(r);
+        synchronized ( lock ) {
+            Collections.sort(this.resources);
+            final Iterator<RegisteredResourceImpl> i = resources.iterator();
+            boolean first = true;
+            while ( i.hasNext() ) {
+                final TaskResource r = i.next();
+                if ( r.getURL().equals(url) ) {
+                    if ( first && (r.getState() == ResourceState.INSTALLED
+                            || r.getState() == ResourceState.INSTALL)) {
+                        LOGGER.debug("Marking for uninstalling: {}", r);
+                        
((RegisteredResourceImpl)r).setState(ResourceState.UNINSTALL);
+                    } else {
+                        LOGGER.debug("Removing unused: {}", r);
+                        i.remove();
+                        this.cleanup(r);
+                    }
                 }
+                first = false;
             }
-            first = false;
         }
     }
 
@@ -366,34 +401,35 @@ public class EntityResourceList implemen
      * @return <code>true</code> if another cycle should be started.
      */
     public boolean compact() {
-        Collections.sort(this.resources);
-        boolean startNewCycle = false;
-        final List<TaskResource> toDelete = new ArrayList<TaskResource>();
-        boolean first = true;
-        for(final TaskResource r : resources) {
-            if ( r.getState() == ResourceState.UNINSTALLED || (!first && 
r.getState() == ResourceState.UNINSTALL) ) {
-                toDelete.add(r);
+        synchronized ( lock ) {
+            Collections.sort(this.resources);
+            boolean startNewCycle = false;
+            final List<TaskResource> toDelete = new ArrayList<TaskResource>();
+            boolean first = true;
+            for(final TaskResource r : resources) {
+                if ( r.getState() == ResourceState.UNINSTALLED || (!first && 
r.getState() == ResourceState.UNINSTALL) ) {
+                    toDelete.add(r);
+                }
+                first = false;
             }
-            first = false;
-        }
 
-        if (!toDelete.isEmpty()) {
-            // Avoid resources.remove(r) as the resource might have
-            // changed since it was added, which causes it to compare()
-            // differently and trip the TreeSet.remove() search.
-            final Set<RegisteredResourceImpl> copy = new 
HashSet<RegisteredResourceImpl>(resources);
-            for(final RegisteredResource r : toDelete) {
-                copy.remove(r);
-                this.cleanup(r);
-                LOGGER.debug("Removing uninstalled from list: {}", r);
-            }
-            resources.clear();
-            resources.addAll(copy);
-            if ( !this.isEmpty() ) {
-                startNewCycle = true;
+            if (!toDelete.isEmpty()) {
+                // Avoid resources.remove(r) as the resource might have
+                // changed since it was added, which causes it to compare()
+                // differently and trip the TreeSet.remove() search.
+                final Set<RegisteredResourceImpl> copy = new 
HashSet<RegisteredResourceImpl>(resources);
+                for(final RegisteredResource r : toDelete) {
+                    copy.remove(r);
+                    this.cleanup(r);
+                    LOGGER.debug("Removing uninstalled from list: {}", r);
+                }
+                resources.clear();
+                resources.addAll(copy);
+                if ( !this.isEmpty() ) {
+                    startNewCycle = true;
+                }
             }
+            return startNewCycle;
         }
-
-        return startNewCycle;
     }
 }

Modified: 
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java?rev=1765129&r1=1765128&r2=1765129&view=diff
==============================================================================
--- 
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
 (original)
+++ 
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
 Sun Oct 16 09:52:27 2016
@@ -237,6 +237,7 @@ implements OsgiInstaller, ResourceChange
     /**
      * @see java.lang.Runnable#run()
      */
+    @Override
     public void run() {
         logger.debug("Main background thread starts");
         try {
@@ -380,6 +381,7 @@ implements OsgiInstaller, ResourceChange
     /**
      * @see 
org.apache.sling.installer.api.OsgiInstaller#updateResources(java.lang.String, 
org.apache.sling.installer.api.InstallableResource[], java.lang.String[])
      */
+    @Override
     public void updateResources(final String scheme,
             final InstallableResource[] resources,
             final String[] ids) {
@@ -434,6 +436,7 @@ implements OsgiInstaller, ResourceChange
     /**
      * @see 
org.apache.sling.installer.api.OsgiInstaller#registerResources(java.lang.String,
 org.apache.sling.installer.api.InstallableResource[])
      */
+    @Override
     public void registerResources(final String scheme, final 
InstallableResource[] resources) {
         this.listener.start();
         try {
@@ -503,7 +506,7 @@ implements OsgiInstaller, ResourceChange
 
                     final List<TaskResource> toRemove = new 
ArrayList<TaskResource>();
                     boolean first = true;
-                    for(final TaskResource r : group.getResources()) {
+                    for(final TaskResource r : group.listResources()) {
                         if ( r.getScheme().equals(scheme) ) {
                             logger.debug("Checking {}", r);
                             // search if we have a new entry with the same url
@@ -583,7 +586,7 @@ implements OsgiInstaller, ResourceChange
             sb.append(id);
             sb.append("\n    RegisteredResource.info=[");
             String sep = "";
-            for(final RegisteredResource rr : 
this.persistentList.getEntityResourceList(id).getResources()) {
+            for(final RegisteredResource rr : 
this.persistentList.getEntityResourceList(id).listResources()) {
                 sb.append(sep);
                 sep=", ";
                 sb.append(rr);
@@ -745,6 +748,7 @@ implements OsgiInstaller, ResourceChange
 
             final InstallationContext ctx = new InstallationContext() {
 
+                @Override
                 public void addTaskToNextCycle(final InstallTask t) {
                     logger.warn("Deprecated method addTaskToNextCycle was 
called. Task will be executed in this cycle instead: {}", t);
                     synchronized ( tasks ) {
@@ -752,6 +756,7 @@ implements OsgiInstaller, ResourceChange
                     }
                 }
 
+                @Override
                 public void addTaskToCurrentCycle(final InstallTask t) {
                     logger.debug("Adding {}task to current cycle: {}", 
t.isAsynchronousTask() ? "async " : "", t);
                     synchronized ( tasks ) {
@@ -759,6 +764,7 @@ implements OsgiInstaller, ResourceChange
                     }
                 }
 
+                @Override
                 public void addAsyncTask(final InstallTask t) {
                     if ( t.isAsynchronousTask() ) {
                         logger.warn("Deprecated method addAsyncTask was 
called: {}", t);
@@ -769,10 +775,12 @@ implements OsgiInstaller, ResourceChange
                     }
                 }
 
+                @Override
                 public void log(final String message, final Object... args) {
                     auditLogger.info(message, args);
                 }
 
+                @Override
                 public void asyncTaskFailed(final InstallTask t) {
                     // persist all changes and retry restart
                     // remove attribute
@@ -926,6 +934,7 @@ implements OsgiInstaller, ResourceChange
     /**
      * @see org.apache.sling.installer.api.tasks.RetryHandler#scheduleRetry()
      */
+    @Override
     public void scheduleRetry() {
         logger.debug("scheduleRetry called");
         this.listener.start();
@@ -947,6 +956,7 @@ implements OsgiInstaller, ResourceChange
      * Store the changes in an internal queue, the queue is processed in 
{@link #processUpdateInfos()}.
      * @see 
org.apache.sling.installer.api.ResourceChangeListener#resourceAddedOrUpdated(java.lang.String,
 java.lang.String, java.io.InputStream, java.util.Dictionary, Map)
      */
+    @Override
     public void resourceAddedOrUpdated(final String resourceType,
             final String entityId,
             final InputStream is,
@@ -982,6 +992,7 @@ implements OsgiInstaller, ResourceChange
      * Store the changes in an internal queue, the queue is processed in 
{@link #processUpdateInfos()}.
      * @see 
org.apache.sling.installer.api.ResourceChangeListener#resourceRemoved(java.lang.String,
 java.lang.String)
      */
+    @Override
     public void resourceRemoved(final String resourceType, String resourceId) {
         final UpdateInfo ui = new UpdateInfo();
         ui.resourceType = resourceType;
@@ -1273,6 +1284,7 @@ implements OsgiInstaller, ResourceChange
     /**
      * @see 
org.apache.sling.installer.api.info.InfoProvider#getInstallationState()
      */
+    @Override
     public InstallationState getInstallationState() {
         synchronized ( this.resourcesLock ) {
             final InstallationState state = new InstallationState() {
@@ -1281,14 +1293,17 @@ implements OsgiInstaller, ResourceChange
                 private final List<ResourceGroup> installedResources = new 
ArrayList<ResourceGroup>();
                 private final List<RegisteredResource> untransformedResources 
= new ArrayList<RegisteredResource>();
 
+                @Override
                 public List<ResourceGroup> getActiveResources() {
                     return activeResources;
                 }
 
+                @Override
                 public List<ResourceGroup> getInstalledResources() {
                     return installedResources;
                 }
 
+                @Override
                 public List<RegisteredResource> getUntransformedResources() {
                     return untransformedResources;
                 }
@@ -1310,50 +1325,62 @@ implements OsgiInstaller, ResourceChange
                     for(final TaskResource tr : group.getResources()) {
                         resources.add(new Resource() {
 
+                            @Override
                             public String getScheme() {
                                 return tr.getScheme();
                             }
 
+                            @Override
                             public String getURL() {
                                 return tr.getURL();
                             }
 
+                            @Override
                             public String getType() {
                                 return tr.getType();
                             }
 
+                            @Override
                             public InputStream getInputStream() throws 
IOException {
                                 return tr.getInputStream();
                             }
 
+                            @Override
                             public Dictionary<String, Object> getDictionary() {
                                 return tr.getDictionary();
                             }
 
+                            @Override
                             public String getDigest() {
                                 return tr.getDigest();
                             }
 
+                            @Override
                             public int getPriority() {
                                 return tr.getPriority();
                             }
 
+                            @Override
                             public String getEntityId() {
                                 return tr.getEntityId();
                             }
 
+                            @Override
                             public ResourceState getState() {
                                 return tr.getState();
                             }
 
+                            @Override
                             public Version getVersion() {
                                 return tr.getVersion();
                             }
 
+                            @Override
                             public long getLastChange() {
                                 return 
((RegisteredResourceImpl)tr).getLastChange();
                             }
 
+                            @Override
                             public Object getAttribute(final String key) {
                                 return tr.getAttribute(key);
                             }
@@ -1375,10 +1402,12 @@ implements OsgiInstaller, ResourceChange
                     }
                     final ResourceGroup rg = new ResourceGroup() {
 
+                        @Override
                         public List<Resource> getResources() {
                             return resources;
                         }
 
+                        @Override
                         public String getAlias() {
                             return alias;
                         }
@@ -1407,6 +1436,7 @@ implements OsgiInstaller, ResourceChange
 
     private static final Comparator<ResourceGroup> COMPARATOR = new 
Comparator<ResourceGroup>() {
 
+        @Override
         public int compare(ResourceGroup o1, ResourceGroup o2) {
             RegisteredResource r1 = null;
             RegisteredResource r2 = null;

Modified: 
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java?rev=1765129&r1=1765128&r2=1765129&view=diff
==============================================================================
--- 
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java
 (original)
+++ 
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java
 Sun Oct 16 09:52:27 2016
@@ -142,7 +142,7 @@ public class PersistentResourceList {
      */
     private void updateCache() {
         for(final EntityResourceList group : this.data.values()) {
-            for(final RegisteredResource rr : group.getResources()) {
+            for(final RegisteredResource rr : group.listResources()) {
                 if ( ((RegisteredResourceImpl)rr).hasDataFile() ) {
                     FileDataStore.SHARED.updateDigestCache(rr.getURL(), 
((RegisteredResourceImpl)rr).getDataFile(), rr.getDigest());
                 }
@@ -193,7 +193,7 @@ public class PersistentResourceList {
         }
         // installed resources are next
         for(final EntityResourceList group : this.data.values()) {
-            for(final RegisteredResource rr : group.getResources()) {
+            for(final RegisteredResource rr : group.listResources()) {
                 if ( rr.getURL().equals(input.getURL()) && ( 
rr.getDigest().equals(input.getDigest()))) {
                     // if we found the resource we can return after updating
                     ((RegisteredResourceImpl)rr).update(input);


Reply via email to