Spring for Apache Hadoop

org.springframework.yarn.container
Class AbstractYarnContainer

java.lang.Object
  extended by org.springframework.yarn.container.AbstractYarnContainer
All Implemented Interfaces:
LongRunningYarnContainer, YarnContainer, YarnContainerRuntime
Direct Known Subclasses:
AbstractIntegrationYarnContainer, DefaultYarnContainer

public abstract class AbstractYarnContainer
extends java.lang.Object
implements LongRunningYarnContainer, YarnContainerRuntime

Base implementation of YarnContainer providing some common functionality like environment properties, command line parameters and handling of the run().

Author:
Janne Valkealahti

Constructor Summary
AbstractYarnContainer()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractYarnContainer

public AbstractYarnContainer()
Method Detail

run

public final void run()
Description copied from interface: YarnContainer
This method is called when something is ran in a container.

Specified by:
run in interface YarnContainer

setEnvironment

public void setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
Description copied from interface: YarnContainer
Sets the environment variables. This method should be used by a launcher or any other party handling creation of a container.

Specified by:
setEnvironment in interface YarnContainer
Parameters:
environment - the environment variables

setParameters

public void setParameters(java.util.Properties parameters)
Description copied from interface: YarnContainer
Sets the parameters. This method should be used by a launcher or any other party handling being aware of a command line parameters.

Specified by:
setParameters in interface YarnContainer
Parameters:
parameters - the parameters

getConfiguration

public org.apache.hadoop.conf.Configuration getConfiguration()
Gets the Yarn configuration.

Returns:
the Yarn configuration

setConfiguration

public void setConfiguration(org.apache.hadoop.conf.Configuration configuration)
Sets the Yarn configuration.

Parameters:
configuration - the new Yarn configuration

getEnvironment

public java.lang.String getEnvironment(java.lang.String key)
Gets the environment variable.

Parameters:
key - the key
Returns:
the environment variable or null if key doesn't exist

getEnvironment

public java.util.Map<java.lang.String,java.lang.String> getEnvironment()
Gets the environment.

Specified by:
getEnvironment in interface YarnContainerRuntime
Returns:
the environment

getParameters

public java.util.Properties getParameters()
Gets the parameters.

Specified by:
getParameters in interface YarnContainerRuntime
Returns:
the parameters

addContainerStateListener

public void addContainerStateListener(ContainerStateListener listener)
Description copied from interface: LongRunningYarnContainer
Adds the container state listener.

Specified by:
addContainerStateListener in interface LongRunningYarnContainer
Parameters:
listener - the ContainerStateListener

isWaitCompleteState

public boolean isWaitCompleteState()
Description copied from interface: LongRunningYarnContainer
Indication for possible handler using this bean whether it should wait COMPLETED state.

Specified by:
isWaitCompleteState in interface LongRunningYarnContainer
Returns:
True if complete state should be wait
See Also:
LongRunningYarnContainer.addContainerStateListener(ContainerStateListener)

notifyCompleted

protected void notifyCompleted()
Notify completed state to container state listeners.


notifyCompleted

protected void notifyCompleted(int exit)
Notify completed state to container state listeners.

Parameters:
exit - the exit

notifyContainerState

protected void notifyContainerState(ContainerStateListener.ContainerState state,
                                    java.lang.Object exit)
Notify state to container state listeners.

Parameters:
state - the state
exit - the exit

runInternal

protected abstract void runInternal()
Internal method to handle the actual run() method.


Spring for Apache Hadoop