全程40+min,无算法
for (int i = 0, j = 0; i < this.fileSize; i += MappedFile.OS_PAGE_SIZE, j++) { byteBuffer.put(i, (byte) 0); // force flush when flush disk type is sync if (type == FlushDiskType.SYNC_FLUSH) { if ((i / OS_PAGE_SIZE) - (flush / OS_PAGE_SIZE) >= pages) { flush = i; mappedByteBuffer.force(); } } // prevent gc if (j % 1000 == 0) { log.info("j={}, costTime={}", j, System.currentTimeMillis() - time); time = System.currentTimeMillis(); try { Thread.sleep(0); } catch (InterruptedException e) { log.error("Interrupted", e); } } }
问题是 Thread.sleep(0)有什么用?(和GC有关系)
16. 讲一下安全点
17. 用没用过clone方法,为什么重写clone方法一定要实现Cloneable接口,这样设计合理吗?要是你来设计,你如何设计?
#用友##用友sp#