public abstract class AbstractYarnContainer extends LifecycleObjectSupport implements LongRunningYarnContainer, YarnContainerRuntime
YarnContainer
providing
some common functionality like environment properties,
command line parameters and handling of the run()
.Constructor and Description |
---|
AbstractYarnContainer() |
Modifier and Type | Method and Description |
---|---|
void |
addContainerStateListener(ContainerStateListener listener)
Adds the container state listener.
|
org.apache.hadoop.conf.Configuration |
getConfiguration()
Gets the Yarn configuration.
|
java.util.Map<java.lang.String,java.lang.String> |
getEnvironment()
Gets the environment.
|
java.lang.String |
getEnvironment(java.lang.String key)
Gets the environment variable.
|
java.util.Properties |
getParameters()
Gets the parameters.
|
boolean |
isWaitCompleteState()
Indication for possible handler using this bean whether
it should wait
COMPLETED
state. |
protected void |
notifyCompleted()
Notify completed state to container state listeners.
|
protected void |
notifyCompleted(int exit)
Notify completed state to container state listeners.
|
protected void |
notifyContainerState(ContainerStateListener.ContainerState state,
java.lang.Object exit)
Notify state to container state listeners.
|
void |
run()
This method is called when something is ran
in a container.
|
protected abstract void |
runInternal()
Internal method to handle the actual
run() method. |
void |
setConfiguration(org.apache.hadoop.conf.Configuration configuration)
Sets the Yarn configuration.
|
void |
setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
Sets the environment variables.
|
void |
setParameters(java.util.Properties parameters)
Sets the parameters.
|
afterPropertiesSet, doStart, doStop, getBeanFactory, getPhase, getTaskExecutor, getTaskScheduler, getYarnEventPublisher, isAutoStartup, isRunning, onInit, setAutoStartup, setBeanFactory, setPhase, setTaskExecutor, setTaskScheduler, setYarnEventPublisher, start, stop, stop
public final void run()
YarnContainer
run
in interface YarnContainer
public void setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
YarnContainer
setEnvironment
in interface YarnContainer
environment
- the environment variablespublic void setParameters(java.util.Properties parameters)
YarnContainer
setParameters
in interface YarnContainer
parameters
- the parameterspublic void addContainerStateListener(ContainerStateListener listener)
LongRunningYarnContainer
addContainerStateListener
in interface LongRunningYarnContainer
listener
- the ContainerStateListener
public boolean isWaitCompleteState()
LongRunningYarnContainer
COMPLETED
state.isWaitCompleteState
in interface LongRunningYarnContainer
LongRunningYarnContainer.addContainerStateListener(ContainerStateListener)
public org.apache.hadoop.conf.Configuration getConfiguration()
public void setConfiguration(org.apache.hadoop.conf.Configuration configuration)
configuration
- the new Yarn configurationpublic java.lang.String getEnvironment(java.lang.String key)
key
- the keynull
if key doesn't existpublic java.util.Map<java.lang.String,java.lang.String> getEnvironment()
getEnvironment
in interface YarnContainerRuntime
public java.util.Properties getParameters()
getParameters
in interface YarnContainerRuntime
protected void notifyCompleted()
protected void notifyCompleted(int exit)
exit
- the exitprotected void notifyContainerState(ContainerStateListener.ContainerState state, java.lang.Object exit)
state
- the stateexit
- the exitprotected abstract void runInternal()
run()
method.