[
https://issues.apache.org/jira/browse/KAFKA-20958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18105574#comment-18105574
]
Chia-Ping Tsai commented on KAFKA-20958:
----------------------------------------
{code:java}
@InterfaceAudience.Public
public class CloseOptions {
GroupMembershipOperation operation = GroupMembershipOperation.DEFAULT;
Optional<Duration> timeout = Optional.of(Duration.ofMillis(Long.MAX_VALUE));
}
{code}
{code:java}
@InterfaceAudience.Private
public final class CloseOptionsInternalAccessor {
private CloseOptionsInternalAccessor() {}
public static Optional<Duration> timeout(CloseOptions options) {
return options.timeout;
}
public static CloseOptions.GroupMembershipOperation operation(CloseOptions
options) {
return options.operation;
}
}
{code}
> Introduce internal accessor pattern to encapsulate cross-package APIs
> ---------------------------------------------------------------------
>
> Key: KAFKA-20958
> URL: https://issues.apache.org/jira/browse/KAFKA-20958
> Project: Kafka
> Issue Type: Improvement
> Reporter: Chia-Ping Tsai
> Assignee: Chia-Ping Tsai
> Priority: Critical
> Labels: need-kip
>
> Currently, to allow cross-package instantiation or state access for internal
> Kafka components, we either:
> # Leak internal classes (like Time) in public constructors.
> # Expose properties as protected.
> We should introduce the Internal Accessor / Factory Pattern (using
> package-private scopes and `@InterfaceAudience.Private` helper classes) to
> cleanly encapsulate these.
> Subsequently, we will deprecate the leaked public constructors/methods to
> ensure we can remove them in 5.0.
> related discussion:
> https://lists.apache.org/thread/1kmyqody36dhnzj5ph858zsfpl4qhm7l
> https://github.com/apache/kafka/pull/21337#discussion_r3574009798
--
This message was sent by Atlassian Jira
(v8.20.10#820010)