org.apache.storm.utils

## Class ShellBoltMessageQueue

- java.lang.Object
- - org.apache.storm.utils.ShellBoltMessageQueue

- All Implemented Interfaces:
    Serializable

      public class ShellBoltMessageQueue
      extends Object
      implements Serializable

  A data structure for ShellBolt which includes two queues (FIFO), which one is for task ids (unbounded), another one is for bolt msg (bounded).

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ShellBoltMessageQueue()`
    `ShellBoltMessageQueue(int boltMsgCapacity)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `poll(long timeout, TimeUnit unit)` poll() is a core feature of ShellBoltMessageQueue.
    `void` | `putBoltMsg(BoltMsg boltMsg)` put bolt message to its queue.
    `void` | `putTaskIds(List<Integer> taskIds)` put list of task id to its queue.

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

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

- - ### Constructor Detail

    - #### ShellBoltMessageQueue

          public ShellBoltMessageQueue(int boltMsgCapacity)

    - #### ShellBoltMessageQueue

          public ShellBoltMessageQueue()

  - ### Method Detail

    - #### putTaskIds

          public void putTaskIds(List<Integer> taskIds)

      put list of task id to its queue.

      Parameters:
        `taskIds` - task ids that received the tuples

    - #### putBoltMsg

          public void putBoltMsg(BoltMsg boltMsg)
                          throws InterruptedException

      put bolt message to its queue.

      Parameters:
        `boltMsg` - BoltMsg to pass to subprocess
      Throws:
        `InterruptedException`

    - #### poll

          public Object poll(long timeout,
                             TimeUnit unit)
                      throws InterruptedException

      poll() is a core feature of ShellBoltMessageQueue. It retrieves and removes the head of one queues, waiting up to the specified wait time if necessary for an element to become available. There’s priority that what queue it retrieves first, taskIds is higher than boltMsgQueue.

      Parameters:
        `timeout` - how long to wait before giving up, in units of unit
        `unit` - a TimeUnit determining how to interpret the timeout parameter
      Returns:
        `List<Integer>` if task id is available, BoltMsg if task id is not available but bolt message is available, null if the specified waiting time elapses before an element is available.
      Throws:
        `InterruptedException`

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