@InterfaceAudience.Public @InterfaceStability.Evolving public class NMTokenCache extends Object
 By default YARN client libraries AMRMClient and NMClient use
 getSingleton() instance of the cache.
 
AMRMClient and NMClient are already set up to use the
     default singleton NMTokenCache
     AMRMClient and the NMClient, setting up
     and using an instance cache is as follows:
 NMTokenCache nmTokenCache = new NMTokenCache(); AMRMClient rmClient = AMRMClient.createAMRMClient(); NMClient nmClient = NMClient.createNMClient(); nmClient.setNMTokenCache(nmTokenCache); ...
AMRMClientAsync and the NMClientAsync,
     setting up and using an instance cache is as follows:
 
   NMTokenCache nmTokenCache = new NMTokenCache();
   AMRMClient rmClient = AMRMClient.createAMRMClient();
   NMClient nmClient = NMClient.createNMClient();
   nmClient.setNMTokenCache(nmTokenCache);
   AMRMClientAsync rmClientAsync = new AMRMClientAsync(rmClient, 1000, [AMRM_CALLBACK]);
   NMClientAsync nmClientAsync = new NMClientAsync("nmClient", nmClient, [NM_CALLBACK]);
   ...
 
   ApplicationMasterProtocol and
     ContainerManagementProtocol directly, setting up and using an
     instance cache is as follows:
 
   NMTokenCache nmTokenCache = new NMTokenCache();
   ...
   ApplicationMasterProtocol amPro = ClientRMProxy.createRMProxy(conf, ApplicationMasterProtocol.class);
   ...
   AllocateRequest allocateRequest = ...
   ...
   AllocateResponse allocateResponse = rmClient.allocate(allocateRequest);
   for (NMToken token : allocateResponse.getNMTokens()) {
     nmTokenCache.setToken(token.getNodeId().toString(), token.getToken());
   }
   ...
   ContainerManagementProtocolProxy nmPro = ContainerManagementProtocolProxy(conf, nmTokenCache);
   ...
   nmPro.startContainer(container, containerContext);
   ...
 
   AMRMClient or
 NMClient, or the async versions of them) with a protocol proxy
 (ContainerManagementProtocolProxy or
 ApplicationMasterProtocol).| Constructor and Description | 
|---|
| NMTokenCache()Creates a NM token cache instance. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | clearCache()It will remove all the nm tokens from its cache | 
| boolean | containsToken(String nodeAddr)Returns true if NMToken is present in cache. | 
| static org.apache.hadoop.yarn.api.records.Token | getNMToken(String nodeAddr)Returns NMToken, null if absent. | 
| static NMTokenCache | getSingleton()Returns the singleton NM token cache. | 
| org.apache.hadoop.yarn.api.records.Token | getToken(String nodeAddr)Returns NMToken, null if absent | 
| int | numberOfTokensInCache()Returns the number of NMTokens present in cache. | 
| void | removeToken(String nodeAddr)Removes NMToken for specified node manager | 
| static void | setNMToken(String nodeAddr,
          org.apache.hadoop.yarn.api.records.Token token)Sets the NMToken for node address only in the singleton obtained from
  getSingleton(). | 
| void | setToken(String nodeAddr,
        org.apache.hadoop.yarn.api.records.Token token)Sets the NMToken for node address | 
public static NMTokenCache getSingleton()
@InterfaceAudience.Public public static org.apache.hadoop.yarn.api.records.Token getNMToken(String nodeAddr)
getSingleton() is looked at for the tokens. If you are using your
 own NMTokenCache that is different from the singleton, use
 getToken(String)nodeAddr - Token NMToken required for communicating with node manager@InterfaceAudience.Public public static void setNMToken(String nodeAddr, org.apache.hadoop.yarn.api.records.Token token)
getSingleton(). If you are using your own NMTokenCache that is
 different from the singleton, use setToken(String, Token)nodeAddr - node address (host:port)token - NMToken@InterfaceAudience.Public @InterfaceStability.Evolving public org.apache.hadoop.yarn.api.records.Token getToken(String nodeAddr)
nodeAddr - Token NMToken required for communicating with node
         manager@InterfaceAudience.Public @InterfaceStability.Evolving public void setToken(String nodeAddr, org.apache.hadoop.yarn.api.records.Token token)
nodeAddr - node address (host:port)token - NMToken@InterfaceAudience.Private public boolean containsToken(String nodeAddr)
@InterfaceAudience.Private public int numberOfTokensInCache()
@InterfaceAudience.Private public void removeToken(String nodeAddr)
nodeAddr - node address (host:port)@InterfaceAudience.Private public void clearCache()
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.