public class ContainerManagerImpl extends CompositeService implements ServiceStateChangeListener, ContainerManagementProtocol, EventHandler<ContainerManagerEvent>
CompositeService.CompositeServiceShutdownHook
Service.STATE
Modifier and Type | Field and Description |
---|---|
protected LocalDirsHandlerService |
dirsHandler |
protected AsyncDispatcher |
dispatcher |
STOP_ONLY_STARTED_SERVICES
Constructor and Description |
---|
ContainerManagerImpl(Context context,
ContainerExecutor exec,
DeletionService deletionContext,
NodeStatusUpdater nodeStatusUpdater,
NodeManagerMetrics metrics,
ApplicationACLsManager aclsManager,
LocalDirsHandlerService dirsHandler) |
addIfService, addService, getServices, removeService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
protected LocalDirsHandlerService dirsHandler
protected final AsyncDispatcher dispatcher
public ContainerManagerImpl(Context context, ContainerExecutor exec, DeletionService deletionContext, NodeStatusUpdater nodeStatusUpdater, NodeManagerMetrics metrics, ApplicationACLsManager aclsManager, LocalDirsHandlerService dirsHandler)
public void serviceInit(Configuration conf) throws Exception
AbstractService
AbstractService.init(Configuration)
prevents re-entrancy.
The base implementation checks to see if the subclass has created
a new configuration instance, and if so, updates the base class valueserviceInit
in class CompositeService
conf
- configurationException
- on a failure -these will be caught,
possibly wrapped, and wil; trigger a service stopprotected LogHandler createLogHandler(Configuration conf, Context context, DeletionService deletionService)
public ContainersMonitor getContainersMonitor()
protected ResourceLocalizationService createResourceLocalizationService(ContainerExecutor exec, DeletionService deletionContext)
protected ContainersLauncher createContainersLauncher(Context context, ContainerExecutor exec)
protected void serviceStart() throws Exception
AbstractService
AbstractService.start()
prevents re-entrancy.serviceStart
in class CompositeService
Exception
- if needed -these will be caught,
wrapped, and trigger a service stoppublic void serviceStop() throws Exception
AbstractService
AbstractService.stop()
prevents re-entrancy.
Implementations MUST write this to be robust against failures, including
checks for null references -and for the first failure to not stop other
attempts to shut down parts of the service.serviceStop
in class CompositeService
Exception
- if needed -these will be caught and logged.public void cleanUpApplicationsOnNMShutDown()
public void cleanupContainersOnNMResync()
protected UserGroupInformation getRemoteUgi() throws YarnException
YarnException
@InterfaceAudience.Private protected NMTokenIdentifier selectNMTokenIdentifier(UserGroupInformation remoteUgi)
protected void authorizeUser(UserGroupInformation remoteUgi, NMTokenIdentifier nmTokenIdentifier) throws YarnException
YarnException
@InterfaceAudience.Private protected void authorizeStartRequest(NMTokenIdentifier nmTokenIdentifier, ContainerTokenIdentifier containerTokenIdentifier) throws YarnException
containerTokenIdentifier
- of the container to be startedYarnException
public StartContainersResponse startContainers(StartContainersRequest requests) throws YarnException, IOException
startContainers
in interface ContainerManagementProtocol
requests
- request to start a list of containersYarnException
NMNotYetReadyException
- This exception is thrown when NM starts from scratch but has not
yet connected with RM.IOException
protected ContainerTokenIdentifier verifyAndGetContainerTokenIdentifier(Token token, ContainerTokenIdentifier containerTokenIdentifier) throws YarnException, SecretManager.InvalidToken
@InterfaceAudience.Private protected void updateNMTokenIdentifier(NMTokenIdentifier nmTokenIdentifier) throws SecretManager.InvalidToken
SecretManager.InvalidToken
public StopContainersResponse stopContainers(StopContainersRequest requests) throws YarnException, IOException
stopContainers
in interface ContainerManagementProtocol
requests
- request to stop a list of containersYarnException
IOException
public GetContainerStatusesResponse getContainerStatuses(GetContainerStatusesRequest request) throws YarnException, IOException
getContainerStatuses
in interface ContainerManagementProtocol
request
- request to get ContainerStatus
es of containers with
the specified ContainerId
sContainerStatus
of the
successfully queried containers and a containerId-to-exception map
for failed requests.YarnException
IOException
@InterfaceAudience.Private protected void authorizeGetAndStopContainerRequest(ContainerId containerId, Container container, boolean stopRequest, NMTokenIdentifier identifier) throws YarnException
YarnException
public void handle(ContainerManagerEvent event)
handle
in interface EventHandler<ContainerManagerEvent>
public void setBlockNewContainerRequests(boolean blockNewContainerRequests)
@InterfaceAudience.Private public boolean getBlockNewContainerRequestsStatus()
public void stateChanged(Service service)
ServiceStateChangeListener
stateChanged
in interface ServiceStateChangeListener
service
- the service that has changed.public Context getContext()
public Map<String,ByteBuffer> getAuxServiceMetaData()
Copyright © 2013 Apache Software Foundation. All rights reserved.