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

Lei Yang updated HDFS-16518:
----------------------------
    Description: 
The cache has ttl and can close KeyProvider when cache entry is expired but we 
also want to trigger close cached KeyProvider when DFSClient is closed.
{code:java}
cache = CacheBuilder.newBuilder()
    .expireAfterAccess(expiryMs, TimeUnit.MILLISECONDS)
    .removalListener(new RemovalListener<URI, KeyProvider>() {
      @Override
      public void onRemoval(
          @Nonnull RemovalNotification<URI, KeyProvider> notification) {
        try {
          assert notification.getValue() != null;
          notification.getValue().close();
        } catch (Throwable e) {
          LOG.error(
              "Error closing KeyProvider with uri ["
                  + notification.getKey() + "]", e);
        }
      }
    })
    .build(); {code}
 

  was:
The cache has ttl and can close KeyProvider when cache entry is expired but we 
also want to close underlying KeyProvider when DFSClient is closed. 

 

 


> Cached KeyProvider in KeyProviderCache does not get closed when DFSClient is 
> closed 
> ------------------------------------------------------------------------------------
>
>                 Key: HDFS-16518
>                 URL: https://issues.apache.org/jira/browse/HDFS-16518
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs
>    Affects Versions: 2.10.0
>            Reporter: Lei Yang
>            Priority: Major
>
> The cache has ttl and can close KeyProvider when cache entry is expired but 
> we also want to trigger close cached KeyProvider when DFSClient is closed.
> {code:java}
> cache = CacheBuilder.newBuilder()
>     .expireAfterAccess(expiryMs, TimeUnit.MILLISECONDS)
>     .removalListener(new RemovalListener<URI, KeyProvider>() {
>       @Override
>       public void onRemoval(
>           @Nonnull RemovalNotification<URI, KeyProvider> notification) {
>         try {
>           assert notification.getValue() != null;
>           notification.getValue().close();
>         } catch (Throwable e) {
>           LOG.error(
>               "Error closing KeyProvider with uri ["
>                   + notification.getKey() + "]", e);
>         }
>       }
>     })
>     .build(); {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to