com.github.netty.core.util.Recyclable Maven / Gradle / Ivy
The newest version!
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);
}
}
}