Options
All
  • Public
  • Public/Protected
  • All
Menu

Concurrent, distributed, observable queue.

Methods that require serialization/deserialization may throw RangeError, e.g when there is no suitable serializer for a certain type.

Type Parameters

  • E

Hierarchy

Index

Methods

  • add(item: E): Promise<boolean>
  • Adds given item to the end of the queue. Operation is successful only if queue has required capacity.

    throws

    IllegalStateError if queue is full.

    Parameters

    • item: E

      element to add.

    Returns Promise<boolean>

    true.

  • addAll(items: E[]): Promise<boolean>
  • Adds all items in the specified item array to this queue. If items array changes during this operation, behaviour is unspecified.

    Parameters

    • items: E[]

      items to be added.

    Returns Promise<boolean>

    true if this queue changed, false otherwise.

  • addItemListener(listener: ItemListener<E>, includeValue: boolean): Promise<string>
  • Adds an item listener for this queue. Listener will be invoked for any add/remove item events.

    Parameters

    • listener: ItemListener<E>
    • includeValue: boolean

      true if updated item should be included in the event.

    Returns Promise<string>

    Registration id of the listener.

  • clear(): Promise<void>
  • Removes all of the elements in this queue.

    Returns Promise<void>

  • contains(item: E): Promise<boolean>
  • Returns true if this queue contains the given item.

    Parameters

    • item: E

    Returns Promise<boolean>

    true if this queue contains the item, false otherwise.

  • containsAll(items: E[]): Promise<boolean>
  • Checks if this queue contains all of the items in given array.

    Parameters

    • items: E[]

    Returns Promise<boolean>

    true if thi queue contains all items, false otherwise.

  • destroy(): Promise<void>
  • Destroys this object cluster-wide. Clears all resources taken for this object.

    Returns Promise<void>

  • drainTo(arr: E[], maxElements?: number): Promise<number>
  • Removes all items in this queue and add them to the end of given arr.

    Parameters

    • arr: E[]
    • Optional maxElements: number

      maximum number of elements that would be moved.

    Returns Promise<number>

    number of items moved from this queue to the array.

  • getName(): string
  • Returns the unique name of this object.

    Returns string

  • getPartitionKey(): string
  • Returns the key of the partition that this DistributedObject is assigned to. For a partitioned data structure, the returned value will not be null, but otherwise undefined.

    Returns string

  • getServiceName(): string
  • isEmpty(): Promise<boolean>
  • Checks if this queue contains any element.

    Returns Promise<boolean>

    true if number of elements in this queue is 0.

  • offer(item: E, time?: number): Promise<boolean>
  • Inserts given item at the end of the queue if there is room. If queue capacity is full, offer operation fails.

    Parameters

    • item: E
    • Optional time: number

      if specified, operation waits for time milliseconds for space to become available before returning false.

    Returns Promise<boolean>

    true if the item is successfully added, false otherwise.

  • peek(): Promise<E>
  • Retrieves, but does not remove the head of this queue.

    Returns Promise<E>

    the head of this queue or null if the queue is empty.

  • poll(time?: number): Promise<E>
  • Retrieves and removes the top of this queue.

    Parameters

    • Optional time: number

      operation waits upto time milliseconds if this queue is empty. The default value of this parameter is 0, which means no waiting.

    Returns Promise<E>

    the head of this queue or null if no element is available.

  • put(item: E): Promise<void>
  • Inserts the item at the end of this queue. It waits to return until space becomes available if necessary.

    Parameters

    • item: E

    Returns Promise<void>

  • remainingCapacity(): Promise<number>
  • Returns the number of additional items, this queue can contain.

    Returns Promise<number>

    remaining capacity or Integer.MAX_VALUE at server side.

  • remove(item: E): Promise<boolean>
  • Removes an instance of given item from this queue.

    Parameters

    • item: E

    Returns Promise<boolean>

    true if this queue changed, false otherwise.

  • removeAll(items: E[]): Promise<boolean>
  • Removes all items in given items from this queue.

    Parameters

    • items: E[]

    Returns Promise<boolean>

    true if this queue changed, false otherwise.

  • removeItemListener(registrationId: string): Promise<boolean>
  • Removes an item listener for this queue.

    Parameters

    • registrationId: string

      Registration id of the listener to be removed.

    Returns Promise<boolean>

    true if the item listener is removed, false otherwise.

  • retainAll(items: E[]): Promise<boolean>
  • Retains only the items that are present it given items.

    Parameters

    • items: E[]

    Returns Promise<boolean>

    true if this queue changed, false otherwise.

  • size(): Promise<number>
  • Returns the number of items in this queue.

    Returns Promise<number>

    number of items or Integer.MAX_VALUE if number of elements is more than Integer.MAX_VALUE on server side.

  • take(): Promise<E>
  • Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.

    Returns Promise<E>

    head of the queue.

  • toArray(): Promise<E[]>
  • Returns an array that contains all items of this queue in proper sequence.

    Returns Promise<E[]>

Generated using TypeDoc