Package org.apache.storm.trident.operation

## Class DefaultResourceDeclarer<T extends DefaultResourceDeclarer>

- java.lang.Object
- - org.apache.storm.trident.operation.DefaultResourceDeclarer<T>

- Type Parameters:
    `T` - Must always be the type of the extending class. i.e. `public class SubResourceDeclarer extends DefaultResourceDeclarer<SubResourceDeclarer> {...}`
  All Implemented Interfaces:
    `ResourceDeclarer<T>`, `ITridentResource`
  Direct Known Subclasses:
    `Node`

      public class DefaultResourceDeclarer<T extends DefaultResourceDeclarer>
      extends Object
      implements ResourceDeclarer<T>, ITridentResource

  Default implementation of resources declarer.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultResourceDeclarer()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `T` | `addSharedMemory​(SharedMemory request)` | Add in request for shared memory that this component will use.
    `Map<String,​Number>` | `getResources()` | Get resource.
    `Set<SharedMemory>` | `getSharedMemory()` | Get shared memory.
    `T` | `setCPULoad​(Number amount)` | Set the amount of CPU load for this component.
    `T` | `setMemoryLoad​(Number onHeap)` | Set the amount of on heap memory for this component.
    `T` | `setMemoryLoad​(Number onHeap, Number offHeap)` | Set the amount of memory for this component on and off heap.

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

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

- - ### Constructor Detail

    - #### DefaultResourceDeclarer

          public DefaultResourceDeclarer()

  - ### Method Detail

    - #### setMemoryLoad

          public T setMemoryLoad​(Number onHeap)

      Description copied from interface: `ResourceDeclarer`
      Set the amount of on heap memory for this component.
      Specified by:
        `setMemoryLoad` in interface `ResourceDeclarer<T extends DefaultResourceDeclarer>`
      Parameters:
        `onHeap` - the amount of on heap memory
      Returns:
        this for chaining

    - #### setMemoryLoad

          public T setMemoryLoad​(Number onHeap,
                                 Number offHeap)

      Description copied from interface: `ResourceDeclarer`
      Set the amount of memory for this component on and off heap.
      Specified by:
        `setMemoryLoad` in interface `ResourceDeclarer<T extends DefaultResourceDeclarer>`
      Parameters:
        `onHeap` - the amount of on heap memory
        `offHeap` - the amount of off heap memory
      Returns:
        this for chaining

    - #### setCPULoad

          public T setCPULoad​(Number amount)

      Description copied from interface: `ResourceDeclarer`
      Set the amount of CPU load for this component.
      Specified by:
        `setCPULoad` in interface `ResourceDeclarer<T extends DefaultResourceDeclarer>`
      Parameters:
        `amount` - the amount of CPU
      Returns:
        this for chaining

    - #### getResources

          public Map<String,​Number> getResources()

      Description copied from interface: `ITridentResource`
      Get resource.
      Specified by:
        `getResources` in interface `ITridentResource`
      Returns:
        a name of resource name -> amount of that resource. *Return should never be null!*

    - #### getSharedMemory

          public Set<SharedMemory> getSharedMemory()

      Description copied from interface: `ITridentResource`
      Get shared memory.
      Specified by:
        `getSharedMemory` in interface `ITridentResource`
      Returns:
        the shared memory region requests

    - #### addSharedMemory

          public T addSharedMemory​(SharedMemory request)

      Description copied from interface: `ResourceDeclarer`
      Add in request for shared memory that this component will use. See `SharedOnHeap`, `SharedOffHeapWithinNode`, and `SharedOffHeapWithinWorker` for convenient ways to create shared memory requests.
      Specified by:
        `addSharedMemory` in interface `ResourceDeclarer<T extends DefaultResourceDeclarer>`
      Parameters:
        `request` - the shared memory request for this component
      Returns:
        this for chaining