com.alanpoi.etactivity.protocol.ByteBufCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of et-activity-client Show documentation
Show all versions of et-activity-client Show documentation
Alan POI Et-activity Client
package com.alanpoi.etactivity.protocol;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.ArrayDeque;
import java.util.Queue;
public class ByteBufCache {
private static Queue byteBufCache=new ArrayDeque<>();
public static void init(){
for (int i=0;i<5;i++){
byteBufCache.add(Unpooled.buffer(32));
}
}
public static synchronized ByteBuf getByteBuf(){
if(byteBufCache.size()<=0){
init();
}
return byteBufCache.poll();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy