Home / Function/ schedulingAndCancellingTasks() — netty Function Reference

schedulingAndCancellingTasks() — netty Function Reference

Architecture documentation for the schedulingAndCancellingTasks() function in AbstractSingleThreadEventLoopTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  2012ac34_71c4_b515_84ff_cc5d05dbe7de["schedulingAndCancellingTasks()"]
  eb487d77_b896_e5c3_20f1_2b7144dc7cf5["AbstractSingleThreadEventLoopTest"]
  2012ac34_71c4_b515_84ff_cc5d05dbe7de -->|defined in| eb487d77_b896_e5c3_20f1_2b7144dc7cf5
  style 2012ac34_71c4_b515_84ff_cc5d05dbe7de fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java lines 290–321

    @Test
    void schedulingAndCancellingTasks() throws Exception {
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
            }
        };
        List<ScheduledFuture<?>> tasks = new ArrayList<ScheduledFuture<?>>();
        EventLoopGroup group = newEventLoopGroup();
        try {
            EventLoop eventLoop = group.next();
            for (int i = 0; i < 5000; i++) {
                tasks.add(eventLoop.scheduleAtFixedRate(runnable, 1, 1, MILLISECONDS));
                if (tasks.size() > 500) {
                    tasks.get(PlatformDependent.threadLocalRandom().nextInt(tasks.size())).cancel(false);
                }
            }
            for (ScheduledFuture<?> task : tasks) {
                task.cancel(false);
            }
            for (ScheduledFuture<?> task : tasks) {
                task.await();
            }
            for (ScheduledFuture<?> task : tasks) {
                if (!task.isCancelled()) {
                    task.sync();
                }
            }
        } finally {
            group.shutdownGracefully();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does schedulingAndCancellingTasks() do?
schedulingAndCancellingTasks() is a function in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java.
Where is schedulingAndCancellingTasks() defined?
schedulingAndCancellingTasks() is defined in testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java at line 290.

Analyze Your Own Codebase

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

Try Supermodel Free