This patch makes append synchronized. The SIPI can only grow and elements,
once in the index, cannot be changed. Therefore synchronization on reading
does not seem essential. If the same packet is written twice, the second
time, it will fail gracefully. The packet will still be there. This
should help "CtfTmfContextTest.testTooManyTraces".
Change-Id: Ic4dfcdda71fc1ebb58039066dab836e67458506f
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/54344
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
* @throws CTFException
* If there was a problem reading the entry
*/
- public boolean append(@NonNull ICTFPacketDescriptor entry)
+ public synchronized boolean append(@NonNull ICTFPacketDescriptor entry)
throws CTFException {
/* Validate consistent entry. */
* order.
*/
if (!fEntries.isEmpty() && (entry.getTimestampBegin() < lastElement().getTimestampBegin())) {
- throw new CTFException("Packets begin timestamp decreasing"); //$NON-NLS-1$
+ return false;
}
fEntries.add(entry);