X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=statesystem%2Forg.eclipse.tracecompass.statesystem.core%2Fsrc%2Forg%2Feclipse%2Ftracecompass%2Finternal%2Fstatesystem%2Fcore%2Fbackend%2Fhistorytree%2FHT_IO.java;h=ef04a424e4de3aff0c9be4eee2bf1f9e584f11d5;hb=4790127ede4326bc6aa2098291823ca62c22b0e5;hp=37dfd2c0051e1a5450af0f75bc848d36add38e8d;hpb=d21209962bb402078b01481db075eec3411c320d;p=deliverable%2Ftracecompass.git diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java index 37dfd2c005..ef04a424e4 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java @@ -98,8 +98,10 @@ class HT_IO { LOGGER.finest(() -> "[HtIo:CacheMiss] seqNum=" + seqNb); //$NON-NLS-1$ - io.seekFCToNodePos(io.fFileChannelIn, seqNb); - return HTNode.readNode(io.fConfig, io.fFileChannelIn); + synchronized (io) { + io.seekFCToNodePos(io.fFileChannelIn, seqNb); + return HTNode.readNode(io.fConfig, io.fFileChannelIn); + } } })); @@ -175,7 +177,7 @@ class HT_IO { * reading. Instead of using a big reader-writer lock, we'll * just catch this exception. */ - public synchronized @NonNull HTNode readNode(int seqNumber) throws ClosedChannelException { + public @NonNull HTNode readNode(int seqNumber) throws ClosedChannelException { /* Do a cache lookup. If it's not present it will be loaded from disk */ LOGGER.finest(() -> "[HtIo:CacheLookup] seqNum=" + seqNumber); //$NON-NLS-1$ CacheKey key = new CacheKey(this, seqNumber); @@ -196,7 +198,7 @@ class HT_IO { } } - public synchronized void writeNode(HTNode node) { + public void writeNode(HTNode node) { try { int seqNumber = node.getSequenceNumber(); @@ -205,8 +207,10 @@ class HT_IO { NODE_CACHE.put(key, node); /* Position ourselves at the start of the node and write it */ - seekFCToNodePos(fFileChannelOut, seqNumber); - node.writeSelf(fFileChannelOut); + synchronized (this) { + seekFCToNodePos(fFileChannelOut, seqNumber); + node.writeSelf(fFileChannelOut); + } } catch (IOException e) { /* If we were able to open the file, we should be fine now... */ Activator.getDefault().logError(e.getMessage(), e);