Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
与concurrentlinkedqueue相关的java性能_Java_Performance - Fatal编程技术网

与concurrentlinkedqueue相关的java性能

与concurrentlinkedqueue相关的java性能,java,performance,Java,Performance,我已经在我的应用程序上安装了behviuore。它是多线程应用程序。线程访问共享的concurrentlinkedqueue对象。有时在加载系统时。在下面的部分中,系统运行缓慢,有时在两行日志之间需要120毫秒以上的时间。 任何解释都可能有所帮助 class A { method aA (){ // log line here system.out.println("current time1" +system.getcurrentmillisecond()) bb(queue);

我已经在我的应用程序上安装了behviuore。它是多线程应用程序。线程访问共享的concurrentlinkedqueue对象。有时在加载系统时。在下面的部分中,系统运行缓慢,有时在两行日志之间需要120毫秒以上的时间。 任何解释都可能有所帮助

class A {
   method aA (){

// log line here 
system.out.println("current time1" +system.getcurrentmillisecond())
bb(queue);

}
 method bb (concurrentlinkedqueue    queue){

// logs here 
system.out.println("current time2" +system.getcurrentmillisecond())


}


}

经验法则是,如果您使用的是实时应用程序,那么您就不能相信日志的写入时间,因为您的系统速度太快,而且日志无论如何都是异步的

使用以下命令:

long startTime = System.currentTimeInMillis();

// do your task
long endTime = System.currentTimeInMillis();

Logger.info(endTime - startTime);

“behviuore”是什么意思?@java初学者,我假设它的行为:)@Pradeep Simha:当然,只是有一点问题。日志记录是否异步取决于实现。e、 g.java.util.logger是同步的。