Package org.apache.storm.scheduler.utils

# Class SchedulerConfigCache<T>

java.lang.Object
org.apache.storm.scheduler.utils.SchedulerConfigCache<T>

public class SchedulerConfigCache<T> extends Object
A utility class to cache the scheduler config and refresh after the cache expires.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `SchedulerConfigCache.Reloadable<T>`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SchedulerConfigCache(Map<String,Object> conf, SchedulerConfigCache.Reloadable<T> reloader)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `T`
  `get()`
  Get the scheduler config from cache.
  `void`
  `prepare()`
  `void`
  `refresh()`
  Refresh the config only after the cache expires.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SchedulerConfigCache

    public SchedulerConfigCache(Map<String,Object> conf, SchedulerConfigCache.Reloadable<T> reloader)

- ## Method Details

  - ### prepare

    public void prepare()

  - ### refresh

    public void refresh()
    Refresh the config only after the cache expires. This is not thread-safe and should only be called in single thread.

  - ### get

    public T get()
    Get the scheduler config from cache. This method is thead-safe and can be called in multiple threads.
    Returns:
      the scheduler config