New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RequestLogAccess.getIfAvailable(RequestLogProperty)
#4956
Labels
Milestone
Comments
Can i take this one? |
For sure. Thanks in advance. 🙇♂️ |
Kyoungwoong
added a commit
to Kyoungwoong/armeria
that referenced
this issue
Jun 18, 2023
Modifications: Introduce new API for accessing RequestLog only when specific flags are available. Provide Kotlin users with the ability th utilize null-safe callls Result: Improved efficiency of RequestLog access by reducing redundant checks and computations Enhanced compatibility for Kotlin developers by enabling null-safe calls when accessing RequestLog properties
Kyoungwoong
added a commit
to Kyoungwoong/armeria
that referenced
this issue
Jun 18, 2023
Modifications: Introduce new API for accessing RequestLog only when specific flags are available. Provide Kotlin users with the ability th utilize null-safe callls Result: Improved efficiency of RequestLog access by reducing redundant checks and computations Enhanced compatibility for Kotlin developers by enabling null-safe calls when accessing RequestLog properties
Kyoungwoong
added a commit
to Kyoungwoong/armeria
that referenced
this issue
Jun 19, 2023
Modifications: Introduce new API for accessing RequestLog only when specific flags are available. Provide Kotlin users with the ability th utilize null-safe callls Result: Improved efficiency of RequestLog access by reducing redundant checks and computations Enhanced compatibility for Kotlin developers by enabling null-safe calls when accessing RequestLog properties
Kyoungwoong
added a commit
to Kyoungwoong/armeria
that referenced
this issue
Jun 19, 2023
Modifications: Introduce new API for accessing RequestLog only when specific flags are available. Provide Kotlin users with the ability th utilize null-safe callls Result: Improved efficiency of RequestLog access by reducing redundant checks and computations Enhanced compatibility for Kotlin developers by enabling null-safe calls when accessing RequestLog properties
Kyoungwoong
added a commit
to Kyoungwoong/armeria
that referenced
this issue
Jun 19, 2023
Modifications: Introduce new API for accessing RequestLog only when specific flags are available. Provide Kotlin users with the ability th utilize null-safe callls Result: Improved efficiency of RequestLog access by reducing redundant checks and computations Enhanced compatibility for Kotlin developers by enabling null-safe calls when accessing RequestLog properties
Kyoungwoong
added a commit
to Kyoungwoong/armeria
that referenced
this issue
Jun 19, 2023
Modifications: Introduce new API for accessing RequestLog only when specific flags are available. Provide Kotlin users with the ability th utilize null-safe callls Result: Improved efficiency of RequestLog access by reducing redundant checks and computations Enhanced compatibility for Kotlin developers by enabling null-safe calls when accessing RequestLog properties
Kyoungwoong
added a commit
to Kyoungwoong/armeria
that referenced
this issue
Jun 19, 2023
Modifications: Introduce new API for accessing RequestLog only when specific flags are available. Provide Kotlin users with the ability th utilize null-safe callls Result: Improved efficiency of RequestLog access by reducing redundant checks and computations Enhanced compatibility for Kotlin developers by enabling null-safe calls when accessing RequestLog properties
Kyoungwoong
added a commit
to Kyoungwoong/armeria
that referenced
this issue
Jun 19, 2023
Modifications: Introduce new API for accessing RequestLog only when specific flags are available. Provide Kotlin users with the ability th utilize null-safe callls Result: Improved efficiency of RequestLog access by reducing redundant checks and computations Enhanced compatibility for Kotlin developers by enabling null-safe calls when accessing RequestLog properties
Kyoungwoong
added a commit
to Kyoungwoong/armeria
that referenced
this issue
Jun 19, 2023
Modifications: Introduce new API for accessing RequestLog only when specific flags are available. Provide Kotlin users with the ability th utilize null-safe callls Result: Improved efficiency of RequestLog access by reducing redundant checks and computations Enhanced compatibility for Kotlin developers by enabling null-safe calls when accessing RequestLog properties
Kyoungwoong
added a commit
to Kyoungwoong/armeria
that referenced
this issue
Jun 19, 2023
Modifications: Introduce new API for accessing RequestLog only when specific flags are available. Provide Kotlin users with the ability th utilize null-safe callls Result: Improved efficiency of RequestLog access by reducing redundant checks and computations Enhanced compatibility for Kotlin developers by enabling null-safe calls when accessing RequestLog properties
ikhoon
pushed a commit
that referenced
this issue
Jul 30, 2023
Motivation: The current implementation of RequestLog access in AbstractHttpResponseHandler is verbose and potentially inefficient. Each operation checks the availability of RequestLog properties separately, accessing a volatile variable and computing the available flags multiple times. Additionally, the code style does not align with efficient and concise Kotlin programming practices. Modifications: Introduce new API for accessing RequestLog only when specific flags are available Provide Kotlin users with the ability to utilize null-safe calls Result: Improved efficiency of RequestLog access by reducing redundant checks and computations Enhanced compatibility for Kotlin developers by enabling null-safe calls when accessing RequestLog properties
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Both
RequestLogAccess.isAvailable()
andRequestLogAccess.ensureAvailable()
should be used to safely get aRequestLog
when the givenRequestLogProperty
.armeria/core/src/main/java/com/linecorp/armeria/server/AbstractHttpResponseHandler.java
Lines 116 to 118 in 0ce077e
The code style looks verbose and is not efficient because each operation accesses a volatile variable and computes the available flags.
If we provide an API that returns
RequestLog
only when the given flags are available, it is performant and Kotlin users may take advantage of null safe calls.The text was updated successfully, but these errors were encountered: