cn.nukkit.utils.ThreadCache Maven / Gradle / Ivy
package cn.nukkit.utils;
import cn.nukkit.nbt.stream.FastByteArrayOutputStream;
public class ThreadCache {
public static void clean() {
idArray.clean();
dataArray.clean();
byteCache6144.clean();
boolCache4096.clean();
charCache4096.clean();
charCache4096v2.clean();
fbaos.clean();
binaryStream.clean();
intCache256.clean();
byteCache256.clean();
}
public static final IterableThreadLocal idArray = new IterableThreadLocal() {
@Override
public byte[][] init() {
return new byte[16][];
}
};
public static final IterableThreadLocal dataArray = new IterableThreadLocal() {
@Override
public byte[][] init() {
return new byte[16][];
}
};
public static final IterableThreadLocal byteCache6144 = new IterableThreadLocal() {
@Override
public byte[] init() {
return new byte[6144];
}
};
public static final IterableThreadLocal byteCache256 = new IterableThreadLocal() {
@Override
public byte[] init() {
return new byte[256];
}
};
public static final IterableThreadLocal boolCache4096 = new IterableThreadLocal() {
@Override
public boolean[] init() {
return new boolean[4096];
}
};
public static final IterableThreadLocal charCache4096v2 = new IterableThreadLocal() {
@Override
public char[] init() {
return new char[4096];
}
};
public static final IterableThreadLocal charCache4096 = new IterableThreadLocal() {
@Override
public char[] init() {
return new char[4096];
}
};
public static final IterableThreadLocal intCache256 = new IterableThreadLocal() {
@Override
public int[] init() {
return new int[256];
}
};
public static final IterableThreadLocal fbaos = new IterableThreadLocal() {
@Override
public FastByteArrayOutputStream init() {
return new FastByteArrayOutputStream(1024);
}
};
public static final IterableThreadLocal binaryStream = new IterableThreadLocal() {
@Override
public BinaryStream init() {
return new BinaryStream();
}
};
}