Spring for Apache Hadoop

org.springframework.yarn.integration
Class IntegrationAppmasterService<T>

java.lang.Object
  extended by org.springframework.yarn.support.LifecycleObjectSupport
      extended by org.springframework.yarn.integration.support.IntegrationObjectSupport
          extended by org.springframework.yarn.integration.IntegrationAppmasterService<T>
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, AppmasterService
Direct Known Subclasses:
MindAppmasterService

public abstract class IntegrationAppmasterService<T>
extends IntegrationObjectSupport
implements AppmasterService

Base implementation of AppmasterService using Spring Integration Ip channels as a communication link.

Author:
Janne Valkealahti

Constructor Summary
IntegrationAppmasterService()
           
 
Method Summary
protected  void doStart()
          Subclasses may implement this method with the start behavior.
protected  void doStop()
          Subclasses may implement this method with the stop behavior.
 java.lang.String getHost()
          Get a hostname where service is running.
 int getPort()
          Get a port where service is running.
abstract  RpcMessage<T> handleMessageInternal(RpcMessage<T> message)
          Implementor need to write this method to process incoming messages.
 boolean hasPort()
          This method should return true if a service will eventually bind to a port.
 void setMessageChannel(org.springframework.messaging.SubscribableChannel messageChannel)
          Sets the message channel where messages are dispatched.
 void setSocketSupport(PortExposingTcpSocketSupport socketSupport)
          Sets the socket support for this service.
 
Methods inherited from class org.springframework.yarn.integration.support.IntegrationObjectSupport
getConversionService, setConversionService
 
Methods inherited from class org.springframework.yarn.support.LifecycleObjectSupport
afterPropertiesSet, getBeanFactory, getPhase, getTaskExecutor, getTaskScheduler, getYarnEventPublisher, isAutoStartup, isRunning, onInit, setAutoStartup, setBeanFactory, setPhase, setTaskExecutor, setTaskScheduler, setYarnEventPublisher, start, stop, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegrationAppmasterService

public IntegrationAppmasterService()
Method Detail

doStart

protected void doStart()
Description copied from class: LifecycleObjectSupport
Subclasses may implement this method with the start behavior. This method will be invoked while holding the LifecycleObjectSupport.lifecycleLock.

Overrides:
doStart in class LifecycleObjectSupport

doStop

protected void doStop()
Description copied from class: LifecycleObjectSupport
Subclasses may implement this method with the stop behavior. This method will be invoked while holding the LifecycleObjectSupport.lifecycleLock.

Overrides:
doStop in class LifecycleObjectSupport

getPort

public int getPort()
Description copied from interface: AppmasterService
Get a port where service is running. This method should return port as zero or negative if port is unknown. For example if underlying communication library is using random ports or other methods so that user doesn't need to worry about it.

Specified by:
getPort in interface AppmasterService
Returns:
Service port, -1 if port unknown.

getHost

public java.lang.String getHost()
Description copied from interface: AppmasterService
Get a hostname where service is running. This method should return null if service is unknown.

Specified by:
getHost in interface AppmasterService
Returns:
Hostname of the server or null if unknown.

hasPort

public boolean hasPort()
Description copied from interface: AppmasterService
This method should return true if a service will eventually bind to a port. User can then do a sleep while waiting AppmasterService.getPort() to return the actual port number.

Specified by:
hasPort in interface AppmasterService
Returns:
True if this service will provide a port

handleMessageInternal

public abstract RpcMessage<T> handleMessageInternal(RpcMessage<T> message)
Implementor need to write this method to process incoming messages.

Parameters:
message - the rpc message wrapping a protocol content
Returns:
a reply rpc message

setMessageChannel

public void setMessageChannel(org.springframework.messaging.SubscribableChannel messageChannel)
Sets the message channel where messages are dispatched.

Parameters:
messageChannel - the message channel

setSocketSupport

public void setSocketSupport(PortExposingTcpSocketSupport socketSupport)
Sets the socket support for this service.

Parameters:
socketSupport - the socket support

Spring for Apache Hadoop