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 and Description
    --- | ---
    `static interface` | `SchedulerConfigCache.Reloadable<T>`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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 Detail

    - #### SchedulerConfigCache

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

  - ### Method Detail

    - #### 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

Copyright © 2021 The Apache Software Foundation. All rights reserved.