Another strange stacktrace in agent log

Thomas Segismont tsegismo at redhat.com
Mon Feb 10 17:12:23 UTC 2014


Le 10/02/2014 17:34, Jay Shaughnessy a écrit :
> A couple of notes/questions on the current branch changes:
> - I'm not sure I quite understand the changes to Resource, with the
> customChildResourcesCollection flag. is this really necessary?

It is necessary otherwise you can't guarantee that all threads are 
working on the same, thread-safe collection.

> - I think you want to update InventoryManager.compactResource() with:
>
>          if (resource.getChildResources().isEmpty()) {
>              resource.setChildResources(Collections.EMPTY_SET);
>          } else {
>              resource.setChildResources(new
> CopyOnWriteArraySet<Resource>(resource.getChildResources());
>          }
>
>    This will replace the server-side type with the thread-safe type as
> resources get processed by inventory sync.
>

No, for the same reason as above.


> - While you're in there, please kill the unnecessary comments at the top
> of cloneResourceWithoutChildren().

You mean these?

// Use a CopyOnWriteArraySet for childResources to allow the field to be 
concurrently accessed safely
// (i.e. to avoid ConcurrentModificationExceptions).

They were written a looong time ago. We wouldn't have seen the 
ConcurrentModificationException if they had been read during resource 
compaction work :)



More information about the rhq-devel mailing list