Gitlab Community Edition Instance

Commit 7a22d7e4 authored by mhellka's avatar mhellka
Browse files

Synchronize on NioResource.getWriteChannel()

parent 013a3756
Pipeline #117126 passed with stages
in 12 minutes and 5 seconds
......@@ -330,7 +330,7 @@ public class NioResource implements Resource {
}
@Override
public WritableByteChannel getWriteChannel(long truncateTo)
public synchronized WritableByteChannel getWriteChannel(long truncateTo)
throws StaleHandle, ExternalResourceException, IOException {
obj.ensureNotStale();
......@@ -340,10 +340,10 @@ public class NioResource implements Resource {
beforeModify();
dest.mtime = System.currentTimeMillis();
if (readChannels != null)
if (readChannels != null) {
readChannels.forEach(Utils::closeQuietly);
if (writeChannel != null)
writeChannel.close();
readChannels = null;
}
if (truncateTo < 0 || truncateTo > getSize())
truncateTo = getSize();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment