mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 21:31:53 +01:00
[cache] Fix concurrent use of a cache entry (#3785)
Closes #3507 Fix some rare case where the concurrent readings of a cache entry can fail. Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
This commit is contained in:
parent
e765af06cb
commit
3ddbdb25ed
@ -296,7 +296,7 @@ public class LRUMediaCacheEntry<V> {
|
||||
}
|
||||
}
|
||||
// the cache file is now filled, get bytes from it.
|
||||
long maxToRead = Math.min(currentSize, sizeToRead);
|
||||
long maxToRead = Math.min(fileChannelLocal.size(), sizeToRead);
|
||||
ByteBuffer byteBufferFromChannelFile = ByteBuffer.allocate((int) maxToRead);
|
||||
int byteReadNumber = fileChannelLocal.read(byteBufferFromChannelFile, Integer.valueOf(start).longValue());
|
||||
logger.trace("Read {} bytes from the filechannel", byteReadNumber);
|
||||
|
Loading…
Reference in New Issue
Block a user