log4j 中 很搞笑的一段代码
2012-03-18 05:47
211 查看
void resize(int newSize) {
if(newSize == maxSize)
return;
LoggingEvent[] tmp = new LoggingEvent[newSize];
// we should not copy beyond the buf array
int len1 = maxSize - first;
// we should not copy beyond the tmp array
len1 = min(len1, newSize);
// er.. how much do we actually need to copy?
// We should not copy more than the actual number of elements.
len1 = min(len1, numElements);
此段代码和注释是在log4j 的 org.apache.log4j.helpers.BoundedFIFO.java 中的,实现的一个先进先出的event pool 里面有这么一段。
注释表明代码作者并不太清楚到度要分配多少size的pool. 所以他/她就在自言自语了。
if(newSize == maxSize)
return;
LoggingEvent[] tmp = new LoggingEvent[newSize];
// we should not copy beyond the buf array
int len1 = maxSize - first;
// we should not copy beyond the tmp array
len1 = min(len1, newSize);
// er.. how much do we actually need to copy?
// We should not copy more than the actual number of elements.
len1 = min(len1, numElements);
此段代码和注释是在log4j 的 org.apache.log4j.helpers.BoundedFIFO.java 中的,实现的一个先进先出的event pool 里面有这么一段。
注释表明代码作者并不太清楚到度要分配多少size的pool. 所以他/她就在自言自语了。
相关文章推荐
- 一段略搞笑的代码
- 分享一段Java搞笑的代码注释
- 今天在群里看到有人分享了一段搞笑的注释代码,觉得挺好玩的,
- 一段女生写的C语言代码(搞笑)
- 分享一段Java搞笑的代码注释
- 一段搞笑代码,让网页上所有图片飞起来转圈
- 一段搞笑代码,让网页上所有图片飞起来转圈
- 分享一段Java搞笑的代码注释
- 【代码笔记】读取一段文字
- 演示volatile 关键字作用的一段C代码
- 一段MYSQL的插入代码
- 一段java枚举代码
- css代码一段,备忘
- 一段整人代码
- 一段为图像处理做准备的BCB代码
- 一段很牛的代码
- JAVA-----myeclipse快捷操作:一段代码自动生成方法 refactor重构extract method抽取方法
- 一段代码学习几个Python知识点
- Log4J的使用和代码
- 一段简单 javascript 的代码,用来验证日期的格式,支持闰年,支持 IE、Fixfox、Chrome 等主流浏览器