You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Attila Doroszlai (Jira)" <ji...@apache.org> on 2023/12/17 09:04:00 UTC

[jira] [Updated] (HDDS-9943) Share TokenRenewer implementation between OFS and O3FS

     [ https://issues.apache.org/jira/browse/HDDS-9943?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Attila Doroszlai updated HDDS-9943:
-----------------------------------
    Description: 
Ozone's {{TokenRenewer}} implementations do not close {{OzoneClient}} after use.

Both O3FS and OFS define their own {{TokenRenewer}} implementation.

Hadoop finds implementations via {{ServiceLoader}}, and uses the first one that handles the kind of token being used:

{code:title=https://github.com/apache/hadoop/blob/7db9895000860605a66dd6403005b0c61a6ed744/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/Token.java#L454-L470}
  private static ServiceLoader<TokenRenewer> renewers =
      ServiceLoader.load(TokenRenewer.class);


  private synchronized TokenRenewer getRenewer() throws IOException {
    if (renewer != null) {
      return renewer;
    }
    renewer = TRIVIAL_RENEWER;
    synchronized (renewers) {
      Iterator<TokenRenewer> it = renewers.iterator();
      while (it.hasNext()) {
        try {
          TokenRenewer candidate = it.next();
          if (candidate.handleKind(this.kind)) {
            renewer = candidate;
            return renewer;
          }
{code}

The two implementations are the same (not FileSystem-specific), kind is the same for both, so we can remove the duplicate one.

  was:
Both O3FS and OFS define their own {{TokenRenewer}} implementation.

Hadoop finds implementations via {{ServiceLoader}}, and uses the first one that handles the kind of token being used:

{code:title=https://github.com/apache/hadoop/blob/7db9895000860605a66dd6403005b0c61a6ed744/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/Token.java#L454-L470}
  private static ServiceLoader<TokenRenewer> renewers =
      ServiceLoader.load(TokenRenewer.class);


  private synchronized TokenRenewer getRenewer() throws IOException {
    if (renewer != null) {
      return renewer;
    }
    renewer = TRIVIAL_RENEWER;
    synchronized (renewers) {
      Iterator<TokenRenewer> it = renewers.iterator();
      while (it.hasNext()) {
        try {
          TokenRenewer candidate = it.next();
          if (candidate.handleKind(this.kind)) {
            renewer = candidate;
            return renewer;
          }
{code}

The two implementations are the same (not FileSystem-specific), kind is the same for both, so we can remove the duplicate one.


> Share TokenRenewer implementation between OFS and O3FS
> ------------------------------------------------------
>
>                 Key: HDDS-9943
>                 URL: https://issues.apache.org/jira/browse/HDDS-9943
>             Project: Apache Ozone
>          Issue Type: Improvement
>          Components: Ozone Filesystem
>            Reporter: Attila Doroszlai
>            Assignee: Attila Doroszlai
>            Priority: Minor
>
> Ozone's {{TokenRenewer}} implementations do not close {{OzoneClient}} after use.
> Both O3FS and OFS define their own {{TokenRenewer}} implementation.
> Hadoop finds implementations via {{ServiceLoader}}, and uses the first one that handles the kind of token being used:
> {code:title=https://github.com/apache/hadoop/blob/7db9895000860605a66dd6403005b0c61a6ed744/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/Token.java#L454-L470}
>   private static ServiceLoader<TokenRenewer> renewers =
>       ServiceLoader.load(TokenRenewer.class);
>   private synchronized TokenRenewer getRenewer() throws IOException {
>     if (renewer != null) {
>       return renewer;
>     }
>     renewer = TRIVIAL_RENEWER;
>     synchronized (renewers) {
>       Iterator<TokenRenewer> it = renewers.iterator();
>       while (it.hasNext()) {
>         try {
>           TokenRenewer candidate = it.next();
>           if (candidate.handleKind(this.kind)) {
>             renewer = candidate;
>             return renewer;
>           }
> {code}
> The two implementations are the same (not FileSystem-specific), kind is the same for both, so we can remove the duplicate one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org