org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair
Class AllocationFileLoaderService

java.lang.Object
  extended by org.apache.hadoop.service.AbstractService
      extended by org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationFileLoaderService
All Implemented Interfaces:
Closeable, org.apache.hadoop.service.Service

@InterfaceAudience.Public
@InterfaceStability.Unstable
public class AllocationFileLoaderService
extends org.apache.hadoop.service.AbstractService


Nested Class Summary
static interface AllocationFileLoaderService.Listener
           
 
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE
 
Field Summary
static long ALLOC_RELOAD_INTERVAL_MS
          Time to wait between checks of the allocation file
static long ALLOC_RELOAD_WAIT_MS
          Time to wait after the allocation has been modified before reloading it (this is done to prevent loading a file that hasn't been fully written).
static org.apache.commons.logging.Log LOG
           
static long THREAD_JOIN_TIMEOUT_MS
           
 
Constructor Summary
AllocationFileLoaderService()
           
AllocationFileLoaderService(org.apache.hadoop.yarn.util.Clock clock)
           
 
Method Summary
 File getAllocationFile(org.apache.hadoop.conf.Configuration conf)
          Path to XML file containing allocations.
 void reloadAllocations()
          Updates the allocation list from the allocation config file.
 void serviceInit(org.apache.hadoop.conf.Configuration conf)
           
 void serviceStart()
           
 void serviceStop()
           
 void setReloadListener(AllocationFileLoaderService.Listener reloadListener)
           
 
Methods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG

ALLOC_RELOAD_INTERVAL_MS

public static final long ALLOC_RELOAD_INTERVAL_MS
Time to wait between checks of the allocation file

See Also:
Constant Field Values

ALLOC_RELOAD_WAIT_MS

public static final long ALLOC_RELOAD_WAIT_MS
Time to wait after the allocation has been modified before reloading it (this is done to prevent loading a file that hasn't been fully written).

See Also:
Constant Field Values

THREAD_JOIN_TIMEOUT_MS

public static final long THREAD_JOIN_TIMEOUT_MS
See Also:
Constant Field Values
Constructor Detail

AllocationFileLoaderService

public AllocationFileLoaderService()

AllocationFileLoaderService

public AllocationFileLoaderService(org.apache.hadoop.yarn.util.Clock clock)
Method Detail

serviceInit

public void serviceInit(org.apache.hadoop.conf.Configuration conf)
                 throws Exception
Overrides:
serviceInit in class org.apache.hadoop.service.AbstractService
Throws:
Exception

serviceStart

public void serviceStart()
                  throws Exception
Overrides:
serviceStart in class org.apache.hadoop.service.AbstractService
Throws:
Exception

serviceStop

public void serviceStop()
                 throws Exception
Overrides:
serviceStop in class org.apache.hadoop.service.AbstractService
Throws:
Exception

getAllocationFile

public File getAllocationFile(org.apache.hadoop.conf.Configuration conf)
Path to XML file containing allocations. If the path is relative, it is searched for in the classpath, but loaded like a regular File.


setReloadListener

public void setReloadListener(AllocationFileLoaderService.Listener reloadListener)

reloadAllocations

public void reloadAllocations()
                       throws IOException,
                              ParserConfigurationException,
                              SAXException,
                              AllocationConfigurationException
Updates the allocation list from the allocation config file. This file is expected to be in the XML format specified in the design doc.

Throws:
IOException - if the config file cannot be read.
AllocationConfigurationException - if allocations are invalid.
ParserConfigurationException - if XML parser is misconfigured.
SAXException - if config file is malformed.


Copyright © 2014 Apache Software Foundation. All Rights Reserved.