Test4880633.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:jdk8u_jdk 作者:
public void run() {
    // run thread a few time
    // object stays the same but NullPointerException appears randomly
    // on dual proccessor a lock is generated
    for (int i = 0; i < THREAD_LENGTH; i++) {
        // create XMLEncoder to ByteArrayOutputStream
        // this is to exclude file locking problems
        XMLEncoder encoder = new XMLEncoder(new ByteArrayOutputStream());
        encoder.setExceptionListener(this);
        // write the object
        // will see randomly null pointer exceptions
        // a bug as object is same through different encode phases
        encoder.writeObject(this.object);
        //close encoder
        encoder.close();
    }
    System.out.println(Thread.currentThread().getName() + " is finished");
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号