jsedding commented on code in PR #2744:
URL: https://github.com/apache/jackrabbit-oak/pull/2744#discussion_r2826679945
##########
oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/AbstractSharedCachingDataStore.java:
##########
@@ -323,11 +322,16 @@ public InputStream getStream() throws DataStoreException {
try {
// If cache configured to 0 will return null
if (cached == null || !cached.exists()) {
- TransientFileFactory fileFactory =
TransientFileFactory.getInstance();
- File tmpFile =
fileFactory.createTransientFile("temp0cache", null, temp);
+ final File tmpFile = Files.createTempFile(temp.toPath(),
"blob-cache-", null).toFile();
try (InputStream in =
backend.getRecord(getIdentifier()).getStream()) {
copyInputStreamToFile(in, tmpFile);
- return new LazyFileInputStream(tmpFile);
+ return new FileInputStream(tmpFile);
Review Comment:
You might have better luck returning an `InputStream` that deletes the
`tmpFile` on `InputStream#close()`. However, that requires all users of the API
to actually close the stream.
Of course this could be combined with the `TransientFileFactory` as a
safeguard. I.e. the `TransientFileFactory` would only clean up after
non-conforming users.
Out of curiosity, why do you want to get rid of the `TransientFileFactory`?
Are there problems with it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]