可以固定速率运行的可运行对象的Java项目过一会儿可以停止吗?约40小时后,矿井保持冻结 [英] Can a java project with a runnable that runs at a fixed rate stop after a while? Mine keeps freezing after about 40 hours
问题描述
我自己学习了Java之后,我开始了一个项目,该项目通过api调用一个叫做torn的游戏从网站获取数据.在某些帮助下,我修复了一些小细节,但我遇到的主要问题仍未解决.经过一天半的运行,该程序将冻结.到目前为止,我什么都找不到.我花了一段时间堆堆,我注意到了一些事情.希望有人可以帮忙.在第一天左右,一切都很好(在 25小时).然后,几个小时后,该程序仍在运行,但是没有方法实例可以全部运行(运行40小时). (某些图像可能需要左右滚动才能查看所有信息). 我还注意到,程序冻结后,可运行线程从定时等待"更改为等待",我也不理解.
After learning java on my own, i began a project for getting data from a website through api calls for a game called torn. There were a few little details i fixed thanks to some help, but the main issue i had is still not solved. after a day and a half of running, the program just freezes. i couldn't find anything about it so far. I took heap dumps for a while and i noticed some things. hope someone can help. During the first day or so, all is well (screenshot of heap dump after 3 hours and after 25 hours). Then, a few hours later, the program is still running but there is no instance of the method that runs it all (screenshot after 30 hours). A few hours after that the program is still running (as in it has not terminated or exited) but there is no activity and no instances of the methods at all (40 hours into run). (Some of the images may require scrolling right and left to see all the info). I also noticed that after the program freezes, the thread for the runnable changes from "timed-waiting" to "waiting", which i also don't understand.
我还为我的项目添加了代码(减去用于连接到网站)以及图片(如果有帮助的话).主要在OtherFactionsStats.java中.
I have also included the code for my project (minus the actual key used in connecting to the site) along with the images in case it helps.The main is in OtherFactionsStats.java .
我非常感谢您提供的所有帮助和建议,尤其是对于Java的初学者身份,并在此先感谢您.
I appreciate all the help and advice -especially with my beginner status in java-, and thank you in advance.
推荐答案
如果RunUpdater
构造函数抛出RuntimeException,则会发生这种情况.
This can happen if the RunUpdater
constructor throws a RuntimeException.