opendal icon indicating copy to clipboard operation
opendal copied to clipboard

feat(bindings/java): add java binding

Open kidylee opened this issue 1 year ago • 7 comments

Explanation:

  • Mutex lock free: in Java, class constructor is thread-safe so calling native method doesn't need a lock.
  • Holding pointer of operator in Operator.java and free it when Java instance be destroyed by GC.
  • Java doesn't native support async/await, maybe we can try Kotlin.

kidylee avatar Mar 23 '23 11:03 kidylee

  • Readme for usage
  • [ ] Development/Contribution guide.
  • [ ] Exceptions need polish to conform Java files related interface.
  • [ ] Cucumber test cases
  • [ ] Experiment: Java doesn't support async/await hence using Kotlin to implement async related API.

Thank you for the pull request! At OpenDAL, we prefer to split pull requests into smaller chunks for faster review and merging. It would be better if we create a tracking issue instead.

In this PR, I expect to the basic setup, and future impove can be done later.

Xuanwo avatar Mar 23 '23 11:03 Xuanwo

  • Readme for usage
  • [ ] Development/Contribution guide.
  • [ ] Exceptions need polish to conform Java files related interface.
  • [ ] Cucumber test cases
  • [ ] Experiment: Java doesn't support async/await hence using Kotlin to implement async related API.

Thank you for the pull request! At OpenDAL, we prefer to split pull requests into smaller chunks for faster review and merging. It would be better if we create a tracking issue instead.

In this PR, I expect to the basic setup, and future impove can be done later.

Sure, I will put them in readme for memo and will add issues after this pr get merged.

kidylee avatar Mar 23 '23 11:03 kidylee

You can use the following command to format license:

 docker run -it --rm -v $(pwd):/github/workspace -u $(id -u):$(id -g) ghcr.io/korandoru/hawkeye-native format

Xuanwo avatar Mar 23 '23 12:03 Xuanwo

You may track them in #1572

suyanhanx avatar Mar 23 '23 12:03 suyanhanx

  • Java doesn't native support async/await, maybe we can try Kotlin.

Sounds good. Can it be integrated? Or is it possible to directly implement Java binding using Kotlin?

suyanhanx avatar Mar 23 '23 12:03 suyanhanx

You may track them in #1572

Thanks.

  • Java doesn't native support async/await, maybe we can try Kotlin.

Sounds good. Can it be integrated? Or is it possible to directly implement Java binding using Kotlin?

Yes, both integration or writing in Kotlin entirely work for Java and Kotlin. A open question is how do we handling running model for Executor and Waker:

  • Keep them in Kotlin
  • Keep them in Rust
  • Both language has them separately.

kidylee avatar Mar 23 '23 12:03 kidylee

A open question is how do we handling running model for Executor and Waker

We can consider implementing them in the future, but for now let's prioritize blocking support. I believe it's best to address one problem at a time.

Xuanwo avatar Mar 23 '23 12:03 Xuanwo