
rpc.turbo.util.concurrent.ThreadLocalBytes Maven / Gradle / Ivy
package rpc.turbo.util.concurrent;
import java.util.function.Supplier;
import rpc.turbo.config.TurboConstants;
/**
* very carefull
*
* @author Hank
*
*/
public final class ThreadLocalBytes {
private static final int ATTACHMENT_INDEX = AttachmentThreadUtils.nextVarIndex();
private static final Supplier supplier = () -> new byte[TurboConstants.MAX_FRAME_LENGTH];
public static byte[] current() {
return AttachmentThreadUtils.getOrUpdate(ATTACHMENT_INDEX, supplier);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy