You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by "reschke (via GitHub)" <gi...@apache.org> on 2025/03/03 15:47:00 UTC

[PR] OAK-11500: Remove usage of Guava io.Closeable [jackrabbit-oak]

reschke opened a new pull request, #2129:
URL: https://github.com/apache/jackrabbit-oak/pull/2129

   (no comment)


-- 
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: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-11500: Remove usage of Guava io.Closeable [jackrabbit-oak]

Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke merged PR #2129:
URL: https://github.com/apache/jackrabbit-oak/pull/2129


-- 
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: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-11500: Remove usage of Guava io.Closeable [jackrabbit-oak]

Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim commented on code in PR #2129:
URL: https://github.com/apache/jackrabbit-oak/pull/2129#discussion_r1978590421


##########
oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/ActiveDeletedBlobCollectorFactory.java:
##########
@@ -324,7 +323,11 @@ public void purgeBlobsDeleted(long before, @NotNull GarbageCollectableBlobStore
             long startBlobTrackerSyncTime = clock.getTime();
             // Synchronize deleted blob ids with the blob id tracker
             try {
-                Closeables.close(idTempDeleteWriter, true);
+                try {

Review Comment:
   Can't we create an Util for this. Instead of repeating these 4 lines, put them under an Utility class in oak-commons. wdyt @reschke ?



-- 
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: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-11500: Remove usage of Guava io.Closeable [jackrabbit-oak]

Posted by "thomasmueller (via GitHub)" <gi...@apache.org>.
thomasmueller commented on code in PR #2129:
URL: https://github.com/apache/jackrabbit-oak/pull/2129#discussion_r1978989861


##########
oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java:
##########
@@ -1091,7 +1098,7 @@ void retrieve(GarbageCollectableBlobStore blobStore,
             } finally {
                 if (idsIter instanceof Closeable) {
                     try {
-                        Closeables.close((Closeable) idsIter, false);
+                        ((Closeable)idsIter).close();

Review Comment:
   null check



##########
oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java:
##########
@@ -380,7 +375,13 @@ protected void markAndSweep(boolean markOnly, boolean forceBlobRetrieve) throws
         } finally {
             statsCollector.updateDuration(sw.elapsed(TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS);
             if (!LOG.isTraceEnabled() && !traceOutput) {
-                Closeables.close(fs, threw);
+                try {
+                    fs.close();

Review Comment:
   What if "fs" is null?



##########
oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStore.java:
##########
@@ -341,9 +340,15 @@ public String writeBlob(InputStream stream, BlobOptions options) throws IOExcept
             stats.uploadFailed();
             throw new IOException(e);
         } finally {
-            //DataStore does not closes the stream internally
+            //DataStore does not close the stream internally
             //So close the stream explicitly
-            Closeables.close(stream, threw);
+            try {
+                stream.close();

Review Comment:
   null check



##########
oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java:
##########
@@ -769,7 +770,13 @@ public long checkConsistency(boolean markOnly) throws Exception {
             }
         } finally {
             if (!traceOutput && (!LOG.isTraceEnabled() && candidates == 0)) {
-                Closeables.close(fs, threw);
+                try {
+                    fs.close();

Review Comment:
   What if "fs" is null?



##########
oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/AbstractSharedCachingDataStore.java:
##########
@@ -335,7 +334,7 @@ public InputStream getStream() throws DataStoreException {
                         copyInputStreamToFile(in, tmpFile);
                         return new LazyFileInputStream(tmpFile);
                     } finally {
-                        Closeables.close(in, false);
+                        in.close();

Review Comment:
   What if "in" is null?



-- 
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: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-11500: Remove usage of Guava io.Closeable [jackrabbit-oak]

Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on code in PR #2129:
URL: https://github.com/apache/jackrabbit-oak/pull/2129#discussion_r1978718877


##########
oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/ActiveDeletedBlobCollectorFactory.java:
##########
@@ -324,7 +323,11 @@ public void purgeBlobsDeleted(long before, @NotNull GarbageCollectableBlobStore
             long startBlobTrackerSyncTime = clock.getTime();
             // Synchronize deleted blob ids with the blob id tracker
             try {
-                Closeables.close(idTempDeleteWriter, true);
+                try {

Review Comment:
   I really don't think we need this. In this case, inlining actually makes things clearer.



-- 
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: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-11500: Remove usage of Guava io.Closeable [jackrabbit-oak]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #2129:
URL: https://github.com/apache/jackrabbit-oak/pull/2129#issuecomment-2694820914

   # Commit-Check ✔️


-- 
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: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org