In fact, its worst than that. Both ReferenceCardinality.MULTIPLE and ReferenceCardinality.AT_LEAST_ONE seem to be randomly failing.

There seems to be some kind of concurrent problem when both services start at the same time: sometimes both are added to the service list, sometimes only one.

I would thus think this is a bug, but I'm not quite sure... Any SCR specialist around to help?

I tried replacing List<FileReaderService> with CopyOnWriteArrayList<MeshReader> but then the component is not started at all. Anyway, I think it would be better IMHO for SCR to deal with concurrency conflicts.

Thanks

Le 22.01.2016 10:50, [email protected] a écrit :
Hi everyone,

I'm back with my issue for an erratum: the solution I provided does
not completely work. When I use:

@Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE)
private List<FileReaderService> availableServices;

Only one of the file reader services is inserted in the list. Output
of the code is:
Reading: test.txt
null
Reading: test.properties
[key6=value6, key5=value5, key4=value4]

However, when using:

@Reference(cardinality = ReferenceCardinality.MULTIPLE)
private List<MeshReader> availableServices;

The output is correct:
Reading: test.txt
[key1 value1, key2 value2, key3 value3]
Reading: test.properties
[key6=value6, key5=value5, key4=value4]

Any idea why? Is this a bug or a feature?

Kind regards,
Ben


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to