t
scalqa

Stream._extend._trigger

trait _trigger[A] extends AnyRef

Trigger Interface

Allows to provide status of ongoing processing

(1 to 10000).all
  .peek(_ => {
    Thread.sleep(1) // Some expensive processing
  })
  .triggerFirst(println("Started"))
  .triggerEvery(2.5, (i, t) => println("Processed " + i + " in " + t + " secs"))
  .triggerLast((i, t) => println("Grand Total " + i + " in " + t + " secs"))
  .drain

// Output
Started
Processed 2493 in 2.500453525 secs
Processed 4988 in 5.000682105 secs
Processed 7489 in 7.501787677 secs
Processed 9989 in 10.00187389 secs
Grand Total 10000 in 10.017199623 secs
Self Type
Stream[A]
Ordering
  1. Alphabetic
Inherited
  1. Stream._extend._trigger
  2. scala.AnyRef
  3. scala.Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Method

  1. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  2. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  3. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  4. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  6. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  7. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  8. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. final def notify(): Unit
    Definition Classes
    AnyRef
  10. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  11. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  12. def toString(): String
    Definition Classes
    AnyRef → Any
  13. def triggerEmpty(f: ⇒ Unit): ~[A]

    Run for empty

    Run for empty

    Runs given function if pipeline is empty

    Note: This method might not execute for some pumping methods, if they determine that pipeline is empty from metadata, and would not even attempt to pump elements. Please, test

    Definition Classes
    _trigger
  14. def triggerEvery(seconds: Double, f: (Int, Double) ⇒ Unit): ~[A]

    Run on timer

    Run on timer

    Runs given function every specified time period in fractional seconds, while elements are being pumped

    Note, it will not run even once if all elements pumped in less than the given seconds

    seconds

    period to run

    f

    function with cumulative element count and cumulative time in seconds as arguments

    Definition Classes
    _trigger
  15. def triggerFirst(f: ⇒ Any): ~[A]

    Runs before first

    Runs before first

    Runs given statement when the first element pumped, but before it is passed down the pipeline

    This will not run for empty pipeline

    Definition Classes
    _trigger
  16. def triggerLast(f: (Int, Double) ⇒ Unit): ~[A]

    Runs after last

    Runs after last

    Runs given function when pumping for the next element brings nothing

    This will not run for empty pipeline

    f

    Function with element count and time in seconds it took to pump all elements

    Definition Classes
    _trigger
  17. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Operator

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any