Home / File/ TimerTask.java — netty Source File

TimerTask.java — netty Source File

Architecture documentation for TimerTask.java, a java file in the netty codebase.

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2012 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.util;

import java.util.concurrent.TimeUnit;

/**
 * A task which is executed after the delay specified with
 * {@link Timer#newTimeout(TimerTask, long, TimeUnit)}.
 */
public interface TimerTask {

    /**
     * Executed after the delay specified with
     * {@link Timer#newTimeout(TimerTask, long, TimeUnit)}.
     *
     * @param timeout a handle which is associated with this task
     */
    void run(Timeout timeout) throws Exception;

    /**
     * Called for {@link TimerTask}s that are successfully canceled via {@link Timeout#cancel()}. Overriding this
     * method allows to for example run some cleanup.
     *
     * @param timeout a handle which is associated with this task
     */
    default void cancelled(Timeout timeout) {
        // By default do nothing.
    }
}

Types

Frequently Asked Questions

What does TimerTask.java do?
TimerTask.java is a source file in the netty codebase, written in java.
Where is TimerTask.java in the architecture?
TimerTask.java is located at common/src/main/java/io/netty/util/TimerTask.java (directory: common/src/main/java/io/netty/util).

Analyze Your Own Codebase

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

Try Supermodel Free