cyclops.reactive.ReactiveSeq.jitter()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中cyclops.reactive.ReactiveSeq.jitter方法的一些代码示例,展示了ReactiveSeq.jitter的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ReactiveSeq.jitter方法的具体详情如下:
包路径:cyclops.reactive.ReactiveSeq
类名称:ReactiveSeq
方法名:jitter

ReactiveSeq.jitter介绍

[英]Introduce a random jitter / time delay between the emission of elements

{ @code 
SimpleTimer timer = new SimpleTimer(); 
ReactiveSeq.of(1, 2, 3, 4, 5, 6) 
.jitter(10000) 
.collect(CyclopsCollectors.toList()); 
assertThat(timer.getElapsedNanoseconds(), greaterThan(20000l)); 
}

[中]在元素发射之间引入随机抖动/时间延迟

{ @code 
SimpleTimer timer = new SimpleTimer(); 
ReactiveSeq.of(1, 2, 3, 4, 5, 6) 
.jitter(10000) 
.collect(CyclopsCollectors.toList()); 
assertThat(timer.getElapsedNanoseconds(), greaterThan(20000l)); 
}

代码示例

代码示例来源:origin: aol/cyclops

/**
 * Introduce a random jitter / time delay between the emission of elements
 * <pre>
 * {@code
 * SimpleTimer timer = new SimpleTimer();
  assertThat(Streamable.of(1,2,3,4,5,6)
            .jitter(10000)
            .collect(CyclopsCollectors.toList())
            .size(),is(6));
  assertThat(timer.getElapsedNanoseconds(),greaterThan(20000l));
 * }
 * </pre>
 * @param maxJitterPeriodInNanos - random number less than this is used for each jitter
 * @return Sequence with a random jitter between element emission
 */
default Streamable<T> jitter(final long maxJitterPeriodInNanos) {
  return fromStream(this.stream().jitter(maxJitterPeriodInNanos));
}

代码示例来源:origin: aol/cyclops

@Test
public void judder(){
  SimpleTimer timer = new SimpleTimer();
  assertThat(of(1,2,3,4,5,6).jitter(10000).to(Streamable::fromStream).collect(Collectors.toList()).size(),is(6));
  assertThat(timer.getElapsedNanoseconds(),greaterThan(20000l));
}
@Test

代码示例来源:origin: aol/cyclops

@Test
public void judder(){
  SimpleTimer timer = new SimpleTimer();
  assertThat(of(1,2,3,4,5,6).jitter(10000).collect(Collectors.toList()).size(),is(6));
  assertThat(timer.getElapsedNanoseconds(),greaterThan(20000l));
}
@Test

代码示例来源:origin: aol/cyclops

@Test
public void judder(){
  SimpleTimer timer = new SimpleTimer();
  assertThat(of(1,2,3,4,5,6).jitter(10000).collect(Collectors.toList()).size(),is(6));
  assertThat(timer.getElapsedNanoseconds(),greaterThan(20000l));
}
@Test

代码示例来源:origin: aol/cyclops

@Test
public void judder(){
  SimpleTimer timer = new SimpleTimer();
  assertThat(of(1,2,3,4,5,6).jitter(10000).collect(Collectors.toList()).size(),is(6));
  assertThat(timer.getElapsedNanoseconds(),greaterThan(20000l));
}
@Test

代码示例来源:origin: aol/cyclops

@Test
public void judder(){
  SimpleTimer timer = new SimpleTimer();
  assertThat(of(1,2,3,4,5,6).jitter(10000).collect(Collectors.toList()).size(),is(6));
  assertThat(timer.getElapsedNanoseconds(),greaterThan(20000l));
}
@Test

代码示例来源:origin: aol/cyclops

@Test
public void judder(){
  SimpleTimer timer = new SimpleTimer();
  assertThat(of(1,2,3,4,5,6).jitter(10000).collect(Collectors.toList()).size(),is(6));
  assertThat(timer.getElapsedNanoseconds(),greaterThan(20000l));
}
@Test

代码示例来源:origin: aol/cyclops

@Test
public void jitter() {
      fromIntStream(IntStream.range(0, 1000))
      .map(it -> it * 100)
      .jitter(100l)
      .peek(System.out::println)
      .forEach(a->{});
}

代码示例来源:origin: aol/cyclops

@Test
public void jitter() {
  Spouts.range(0, 1000)
      .map(it -> it * 100)
      .jitter(100l)
      .peek(System.out::println)
      .forEach(a->{});
}

代码示例来源:origin: aol/cyclops

@Test
public void jitter() {
  Spouts.range(0, 1000)
      .map(it -> it * 100)
      .jitter(100l)
      .peek(System.out::println)
      .forEach(a->{});
}

代码示例来源:origin: aol/cyclops

@Test
public void jitter() {
  Spouts.range(0, 1000)
      .map(it -> it * 100)
      .jitter(100l)
      .peek(System.out::println)
      .forEach(a->{});
}

代码示例来源:origin: aol/cyclops

@Test
public void jitter() {
  Spouts.range(0, 1000)
      .map(it -> it * 100)
      .jitter(100l)
      .peek(System.out::println)
      .forEach(a->{});
}

代码示例来源:origin: aol/cyclops

@Test
public void jitter() {
  Spouts.range(0, 1000)
      .map(it -> it * 100)
      .jitter(100l)
      .peek(System.out::println)
      .forEach(a->{});
}

代码示例来源:origin: com.oath.cyclops/cyclops

/**
 * Introduce a random jitter / time delay between the emission of elements
 * <pre>
 * {@code
 * SimpleTimer timer = new SimpleTimer();
  assertThat(Streamable.of(1,2,3,4,5,6)
            .jitter(10000)
            .collect(CyclopsCollectors.toList())
            .size(),is(6));
  assertThat(timer.getElapsedNanoseconds(),greaterThan(20000l));
 * }
 * </pre>
 * @param maxJitterPeriodInNanos - random number less than this is used for each jitter
 * @return Sequence with a random jitter between element emission
 */
default Streamable<T> jitter(final long maxJitterPeriodInNanos) {
  return fromStream(this.stream().jitter(maxJitterPeriodInNanos));
}

相关文章

微信公众号

最新文章

更多

ReactiveSeq类方法