rishabhdaim commented on code in PR #2744:
URL: https://github.com/apache/jackrabbit-oak/pull/2744#discussion_r2827749955


##########
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:
   Also, this won't work well in Windows:
   
   - On Windows, you cannot delete a file that is open by any process.
   - On Unix-like systems, you can delete an open file, and the file's data 
remains accessible to processes that have it open until all handles are closed.
   
   So basically, on Windows, we would be having garbage files under tmp folders 
since we are opening a Stream before calling delete.
   
   See : 
https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilea



-- 
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]

Reply via email to