Class SharedCacheClientImpl
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.hadoop.yarn.api.ClientSCMProtocolgetFileChecksum(org.apache.hadoop.fs.Path sourceFile) A convenience method to calculate the checksum of a specified file.voidThe method to release a resource with theSharedCacheManager.This method is called once an application is no longer using a claimed resource in the shared cache.protected voidserviceInit(org.apache.hadoop.conf.Configuration conf) protected voidprotected voidprotected voidorg.apache.hadoop.yarn.api.records.URLThe method to claim a resource with theSharedCacheManager.The client uses a checksum to identify the resource and anApplicationIdto identify which application will be using the resource.Methods inherited from class org.apache.hadoop.yarn.client.api.SharedCacheClient
createSharedCacheClientMethods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Constructor Details
-
SharedCacheClientImpl
public SharedCacheClientImpl()
-
-
Method Details
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStop
- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
createClientProxy
@VisibleForTesting protected org.apache.hadoop.yarn.api.ClientSCMProtocol createClientProxy() -
stopClientProxy
@VisibleForTesting protected void stopClientProxy() -
use
public org.apache.hadoop.yarn.api.records.URL use(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, String resourceKey) throws org.apache.hadoop.yarn.exceptions.YarnException Description copied from class:SharedCacheClientThe method to claim a resource with the
SharedCacheManager.The client uses a checksum to identify the resource and anApplicationIdto identify which application will be using the resource.The
SharedCacheManagerresponds with whether or not the resource exists in the cache. If the resource exists, aURLto the resource in the shared cache is returned. If the resource does not exist, null is returned instead.Once a URL has been returned for a resource, that URL is safe to use for the lifetime of the application that corresponds to the provided ApplicationId.
- Specified by:
usein classSharedCacheClient- Parameters:
applicationId- ApplicationId of the application using the resourceresourceKey- the key (i.e. checksum) that identifies the resource- Returns:
- URL to the resource, or null if it does not exist
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException
-
release
public void release(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, String resourceKey) throws org.apache.hadoop.yarn.exceptions.YarnException Description copied from class:SharedCacheClientThe method to release a resource with the
SharedCacheManager.This method is called once an application is no longer using a claimed resource in the shared cache. The client uses a checksum to identify the resource and anApplicationIdto identify which application is releasing the resource.Note: This method is an optimization and the client is not required to call it for correctness.
- Specified by:
releasein classSharedCacheClient- Parameters:
applicationId- ApplicationId of the application releasing the resourceresourceKey- the key (i.e. checksum) that identifies the resource- Throws:
org.apache.hadoop.yarn.exceptions.YarnException
-
getFileChecksum
Description copied from class:SharedCacheClientA convenience method to calculate the checksum of a specified file.- Specified by:
getFileChecksumin classSharedCacheClient- Parameters:
sourceFile- A path to the input file- Returns:
- A hex string containing the checksum digest
- Throws:
IOException
-