Joe
Joe
这种写法没问题的, 很多框架都这么用.但是最好的方式肯定是日志框架. 捕获的目的就是打印, 要么日志框架打印,要么system. 抛出一个new 异常 也是打印,printStackTrace(). 有时候不方便引入日志框架,又不想直接system. 比如一个方法未实现逻辑,就可以直接抛出new 异常,当执行一个逻辑发生错误,也可以抛出new异常. 捕获异常后,直接抛出new异常,最终还是通过system打印的(会阻塞一下,毕竟是同步打印的,所以才会有日志框架代替,因为日志框架都支持异步). 如果不能忍受抛new异常的阻塞,那就用日志框架代替.
Hi, ``` RandomAccessFile FileChannel channel = randomAccessFile.getChannel(); randomAccessFile.write(); channel.force(true); ``` Use the force method,the file be updated in real time. But affects performance. Log4j2,not use the force method. Rewrite RollingRandomAccessFileManager...
> As mentioned in #323 the reason we removed the code in v4 was mostly down to us not using it, making it quite a burden to maintain. > >...
https://github.com/tcmot/Disruptor2 This is a demo, disruptor4.0+WorkerPool.
Hi,@jvz ``` RandomAccessFile FileChannel channel = randomAccessFile.getChannel(); randomAccessFile.write(); channel.force(true); ``` Use the force method,the file be updated in real time. But affects performance. Log4j2,not use the force method. Rewrite RollingRandomAccessFileManager...
Hi,bro. I have implemented this feature. [https://github.com/jdkstack/mini](url) Thanks.
I think this is a deadlock.
Are all servers like this? Is there a problem with the hard drive? If there is no deadlock, it is likely that data cannot be written to the hard drive....