@InterfaceAudience.Private @InterfaceStability.Unstable public class NMClientAsyncImpl extends NMClientAsync
Modifier and Type | Class and Description |
---|---|
protected static class |
NMClientAsyncImpl.ContainerEvent |
protected class |
NMClientAsyncImpl.ContainerEventProcessor |
protected static class |
NMClientAsyncImpl.ContainerEventType
The type of the event of interacting with a container
|
protected static class |
NMClientAsyncImpl.ContainerState |
protected static class |
NMClientAsyncImpl.StartContainerEvent |
protected static class |
NMClientAsyncImpl.StatefulContainer |
NMClientAsync.CallbackHandler
Service.STATE
Modifier and Type | Field and Description |
---|---|
protected ConcurrentMap<ContainerId,NMClientAsyncImpl.StatefulContainer> |
containers |
protected Thread |
eventDispatcherThread |
protected BlockingQueue<NMClientAsyncImpl.ContainerEvent> |
events |
protected static int |
INITIAL_THREAD_POOL_SIZE |
protected int |
maxThreadPoolSize |
protected AtomicBoolean |
stopped |
protected ThreadPoolExecutor |
threadPool |
callbackHandler, client
Modifier | Constructor and Description |
---|---|
|
NMClientAsyncImpl(NMClientAsync.CallbackHandler callbackHandler) |
|
NMClientAsyncImpl(String name,
NMClientAsync.CallbackHandler callbackHandler) |
protected |
NMClientAsyncImpl(String name,
NMClient client,
NMClientAsync.CallbackHandler callbackHandler) |
Modifier and Type | Method and Description |
---|---|
protected NMClientAsyncImpl.ContainerEventProcessor |
getContainerEventProcessor(NMClientAsyncImpl.ContainerEvent event) |
void |
getContainerStatusAsync(ContainerId containerId,
NodeId nodeId) |
protected boolean |
isCompletelyDone(NMClientAsyncImpl.StatefulContainer container) |
protected void |
serviceInit(Configuration conf)
All initialization code needed by a service.
|
protected void |
serviceStart()
Actions called during the INITED to STARTED transition.
|
protected void |
serviceStop()
Actions called during the transition to the STOPPED state.
|
void |
startContainerAsync(Container container,
ContainerLaunchContext containerLaunchContext) |
void |
stopContainerAsync(ContainerId containerId,
NodeId nodeId) |
createNMClientAsync, getCallbackHandler, getClient, setCallbackHandler, setClient
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
protected static final int INITIAL_THREAD_POOL_SIZE
protected ThreadPoolExecutor threadPool
protected int maxThreadPoolSize
protected Thread eventDispatcherThread
protected AtomicBoolean stopped
protected BlockingQueue<NMClientAsyncImpl.ContainerEvent> events
protected ConcurrentMap<ContainerId,NMClientAsyncImpl.StatefulContainer> containers
public NMClientAsyncImpl(NMClientAsync.CallbackHandler callbackHandler)
public NMClientAsyncImpl(String name, NMClientAsync.CallbackHandler callbackHandler)
@InterfaceAudience.Private protected NMClientAsyncImpl(String name, NMClient client, NMClientAsync.CallbackHandler callbackHandler)
protected 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 AbstractService
conf
- configurationException
- on a failure -these will be caught,
possibly wrapped, and wil; trigger a service stopprotected void serviceStart() throws Exception
AbstractService
AbstractService.start()
prevents re-entrancy.serviceStart
in class AbstractService
Exception
- if needed -these will be caught,
wrapped, and trigger a service stopprotected 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 AbstractService
Exception
- if needed -these will be caught and logged.public void startContainerAsync(Container container, ContainerLaunchContext containerLaunchContext)
startContainerAsync
in class NMClientAsync
public void stopContainerAsync(ContainerId containerId, NodeId nodeId)
stopContainerAsync
in class NMClientAsync
public void getContainerStatusAsync(ContainerId containerId, NodeId nodeId)
getContainerStatusAsync
in class NMClientAsync
protected boolean isCompletelyDone(NMClientAsyncImpl.StatefulContainer container)
protected NMClientAsyncImpl.ContainerEventProcessor getContainerEventProcessor(NMClientAsyncImpl.ContainerEvent event)
Copyright © 2013 Apache Software Foundation. All rights reserved.