b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

weakreference java内存泄露分析,java弱引用(weakreferen(6)

电脑杂谈  发布时间:2017-05-27 23:01:53  来源:网络整理

access private members of an inner class inside its innerclass.*/

privateSoftValue(Object k, Object key, ReferenceQueue q){super(k, q);

this.key=key; }

}

/**Here we go through the ReferenceQueue and remove garbagecollected SoftValue objects from the HashMap by looking them

up using the SoftValue.key data member.*/publicvoidprocessQueue(){

SoftValue sv;while((sv=(SoftValue)queue.poll())!=null){

if(sv.get() ==null) { Log.e(" processQueue "," null ");

}else{ Log.e(" processQueue "," Not null ");

} hash.remove(sv.key);//we can access private data!

Log.e(" SoftHashMap "," release" sv.key); }

}/**Here we put the key, value pair into the HashMap using

a SoftValue object.*/publicObject put(Object key, Object value){

processQueue();//throw out garbage collected values first Log.e(" SoftHashMap "," put into" key);

returnhash.put(key,newSoftValue(value, key, queue)); }

publicObject remove(Object key){ processQueue();//throw out garbage collected values first

returnhash.remove(key); }

publicvoidclear(){ hardCache.clear();

processQueue();//throw out garbage collected valueshash.clear();

}publicintsize(){

processQueue();//throw out garbage collected values firstreturnhash.size();

}publicSet entrySet(){

//no, no, you may NOT do that!!! GRRRthrownewUnsupportedOperationException();


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/ruanjian/article-49607-6.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...