You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Retrospection (via GitHub)" <gi...@apache.org> on 2026/01/02 05:32:19 UTC

[PR] [java] Add additional layers support [opendal]

Retrospection opened a new pull request, #7128:
URL: https://github.com/apache/opendal/pull/7128

   ## Summary
   
   This PR adds support for additional layers to the Java bindings to align with Python and Node.js bindings.
   
   ### Added Layers
   
   - **MimeGuessLayer**: Automatically set Content-Type based on file extension
   - **TimeoutLayer**: Add timeout for operations (both IO and non-IO)
   - **LoggingLayer**: Add structured logging for all operations
   - **HotpathLayer**: Add hotpath profiling for performance analysis
   
   ### Changes
   
   - Added 4 new Java layer classes in `bindings/java/src/main/java/org/apache/opendal/layer/`
   - Added corresponding JNI implementations in `bindings/java/src/layer.rs`
   - Updated `bindings/java/Cargo.toml` to enable required features
   - Added tests in `bindings/java/src/test/java/org/apache/opendal/test/LayerTest.java`
   
   ### Testing
   
   All 7 layer tests pass:
   - `testOperatorWithRetryLayer`
   - `testOperatorWithConcurrentLimitLayer`
   - `testOperatorWithMimeGuessLayer`
   - `testOperatorWithTimeoutLayer`
   - `testOperatorWithLoggingLayer`
   - `testOperatorWithThrottleLayer`
   - `testOperatorWithHotpathLayer`
   
   ### Issue
   
   Closes #6738


-- 
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: commits-unsubscribe@opendal.apache.org

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


Re: [PR] feat: add additional layers support [opendal]

Posted by "Retrospection (via GitHub)" <gi...@apache.org>.
Retrospection commented on code in PR #7128:
URL: https://github.com/apache/opendal/pull/7128#discussion_r3104396868


##########
bindings/java/src/main/java/org/apache/opendal/layer/LoggingLayer.java:
##########
@@ -24,6 +24,9 @@
 /**
  * This layer adds structured logging for every operation.
  *
+ * <p>Note: This layer requires proper logging setup (e.g., log4j2, java.util.logging) to work.

Review Comment:
   > Hi, please understand your changes first. `LoggingLayer` integrate rust's `log` crate and thus requires we to provide a `set_logger` call. Users can't configure that through `log4j2` or `java.util.logging`.
   > 
   > Maybe we can start a discussion thread on how we do that.
   
   I have been studying the abstraction role of the OpenDAL layer and now understand the issues with the Java LoggingLayer implementation in my previous PR.
   
   I would like to ask:
   1. Is it okay if I temporarily abandon the implementation of the LoggingLayer part for now?
   2. Alternatively, should I pursue a deeper integration with SLF4J, Log4j, or java.util.logging instead?



-- 
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: commits-unsubscribe@opendal.apache.org

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


Re: [PR] feat: add additional layers support [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #7128:
URL: https://github.com/apache/opendal/pull/7128#discussion_r2656948891


##########
bindings/java/Cargo.toml:
##########
@@ -154,6 +159,12 @@ services-webdav = ["opendal/services-webdav"]
 services-webhdfs = ["opendal/services-webhdfs"]
 services-yandex-disk = ["opendal/services-yandex-disk"]
 
+layers-hotpath = ["opendal/layers-hotpath"]

Review Comment:
   I don't think hotpath is meaningful to java  applications.



##########
bindings/java/Cargo.toml:
##########
@@ -154,6 +159,12 @@ services-webdav = ["opendal/services-webdav"]
 services-webhdfs = ["opendal/services-webhdfs"]
 services-yandex-disk = ["opendal/services-yandex-disk"]
 
+layers-hotpath = ["opendal/layers-hotpath"]
+layers-logging = ["opendal/layers-logging"]

Review Comment:
   Introduce logging alyer without setup logging is no-op



-- 
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: commits-unsubscribe@opendal.apache.org

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


Re: [PR] feat: add additional layers support [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #7128:
URL: https://github.com/apache/opendal/pull/7128#discussion_r2659478763


##########
bindings/java/src/main/java/org/apache/opendal/layer/LoggingLayer.java:
##########
@@ -24,6 +24,9 @@
 /**
  * This layer adds structured logging for every operation.
  *
+ * <p>Note: This layer requires proper logging setup (e.g., log4j2, java.util.logging) to work.

Review Comment:
   Hi, please understand your changes first. `LoggingLayer` integrate rust's `log` crate and thus requires we to provide a `set_logger` call. Users can't configure that through `log4j2` or `java.util.logging`.
   
   Maybe we can start a discussion thread on how we do that.



-- 
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: commits-unsubscribe@opendal.apache.org

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


Re: [PR] [java] Add additional layers support [opendal]

Posted by "PsiACE (via GitHub)" <gi...@apache.org>.
PsiACE commented on PR #7128:
URL: https://github.com/apache/opendal/pull/7128#issuecomment-3704507591

   for toml format , u can use `taplo` to fix 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: commits-unsubscribe@opendal.apache.org

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


Re: [PR] feat: add additional layers support [opendal]

Posted by "Retrospection (via GitHub)" <gi...@apache.org>.
Retrospection commented on code in PR #7128:
URL: https://github.com/apache/opendal/pull/7128#discussion_r2663342563


##########
bindings/java/src/main/java/org/apache/opendal/layer/LoggingLayer.java:
##########
@@ -24,6 +24,9 @@
 /**
  * This layer adds structured logging for every operation.
  *
+ * <p>Note: This layer requires proper logging setup (e.g., log4j2, java.util.logging) to work.

Review Comment:
   Sorry for rough pr. 
   
   Honestly I'm not that familiar with this binding layer, and just think this can be implemented with ai just because it has other language implementation as reference.
   
   I'll do some research to understand what the binding layer is for and then do discussion about implementation.
   
   Thanks for kindly review.



-- 
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: commits-unsubscribe@opendal.apache.org

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