Home / Function/ testScheduleTaskWithFixedDelay() — netty Function Reference

testScheduleTaskWithFixedDelay() — netty Function Reference

Architecture documentation for the testScheduleTaskWithFixedDelay() function in SingleThreadEventLoopTest.java from the netty codebase.

Function java Buffer Search calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  b4160433_6af4_11d4_14e2_5867c031dc3a["testScheduleTaskWithFixedDelay()"]
  42a05bb6_77d1_5163_f1de_dc06e1ae82b0["SingleThreadEventLoopTest"]
  b4160433_6af4_11d4_14e2_5867c031dc3a -->|defined in| 42a05bb6_77d1_5163_f1de_dc06e1ae82b0
  ffeea4bd_17a4_f79b_dd69_84bc4ea6f860["scheduleTaskWithFixedDelayA()"]
  ffeea4bd_17a4_f79b_dd69_84bc4ea6f860 -->|calls| b4160433_6af4_11d4_14e2_5867c031dc3a
  72a06b83_ab1b_1519_4fd7_4e5e7913ca1f["scheduleTaskWithFixedDelayB()"]
  72a06b83_ab1b_1519_4fd7_4e5e7913ca1f -->|calls| b4160433_6af4_11d4_14e2_5867c031dc3a
  b79014df_fa4d_f5ee_0fee_b9e3906bd3e9["run()"]
  b4160433_6af4_11d4_14e2_5867c031dc3a -->|calls| b79014df_fa4d_f5ee_0fee_b9e3906bd3e9
  style b4160433_6af4_11d4_14e2_5867c031dc3a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/SingleThreadEventLoopTest.java lines 293–326

    private static void testScheduleTaskWithFixedDelay(EventLoop loopA) throws InterruptedException {
        final Queue<Long> timestamps = new LinkedBlockingQueue<Long>();
        final int expectedTimeStamps = 3;
        final CountDownLatch allTimeStampsLatch = new CountDownLatch(expectedTimeStamps);
        ScheduledFuture<?> f = loopA.scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                timestamps.add(System.nanoTime());
                try {
                    Thread.sleep(51);
                } catch (InterruptedException e) {
                    // Ignore
                }
                allTimeStampsLatch.countDown();
            }
        }, 100, 100, TimeUnit.MILLISECONDS);
        allTimeStampsLatch.await();
        assertTrue(f.cancel(true));
        Thread.sleep(300);
        assertEquals(expectedTimeStamps, timestamps.size());

        // Check if the task was run without a lag.
        Long previousTimestamp = null;
        for (Long t: timestamps) {
            if (previousTimestamp == null) {
                previousTimestamp = t;
                continue;
            }

            assertThat(t.longValue() - previousTimestamp.longValue()).
                       isGreaterThanOrEqualTo(TimeUnit.MILLISECONDS.toNanos(150));
            previousTimestamp = t;
        }
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does testScheduleTaskWithFixedDelay() do?
testScheduleTaskWithFixedDelay() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/SingleThreadEventLoopTest.java.
Where is testScheduleTaskWithFixedDelay() defined?
testScheduleTaskWithFixedDelay() is defined in transport/src/test/java/io/netty/channel/SingleThreadEventLoopTest.java at line 293.
What does testScheduleTaskWithFixedDelay() call?
testScheduleTaskWithFixedDelay() calls 1 function(s): run.
What calls testScheduleTaskWithFixedDelay()?
testScheduleTaskWithFixedDelay() is called by 2 function(s): scheduleTaskWithFixedDelayA, scheduleTaskWithFixedDelayB.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free