All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.netty.core.util.Recyclable Maven / Gradle / Ivy

package com.github.netty.core.util;

import java.util.function.Consumer;

/**
 * recycled
 *
 * @author wangzihao
 */
public interface Recyclable {

    /**
     * recycle
     */
    default void recycle() {
    }

    /**
     * async recycle
     *
     * @param consumer callback
     * @param       last recycle object
     */
    default  void recycle(Consumer consumer) {
        if (consumer == null) {
            recycle();
        } else {
            consumer.accept(null);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy