Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control running Java SE program remotely

I wrote Java SE program which has deal with really huge dataset of matrices(10^12 matrices). I am generating them through iterator and saving special ones (which satisfy some criteria) either to Java heap or database. So, I understand that it's gonna take a lot of time (probably a few days). In order to operate with all this stuff I decided to run the program on computer which is not at my apartment and has access to the Internet. I want to control runnig process of the program (for me is very important to know is everything OK with the program? Is the program still running?)

My question is how to control that my program is still running (for this purpose I want to use computer at my appartment and the Internet)?

Maybe my program should periodically post (via Java IO API ) messages to websites ( Google Docs and so on). Thanks in advance for all your responses.

like image 470
angry_gopher Avatar asked Apr 15 '26 22:04

angry_gopher


2 Answers

Run your application with JPDA enabled. This way you can connect it remotely, examine threads, etc.

JPDA has a number of other advantages as well, for example hot code replace.

Specification for JPDA is here, the most important is that you have to pass a few JVM options on startup, it will open a port, and you can use Eclipse or NetBeans to attach it from anywhere on the net. You have to make sure that the opened port is accessible through firewalls (local and network).

like image 169
gaborsch Avatar answered Apr 17 '26 12:04

gaborsch


I would go for VisualVM & remote JMX. Setup the server box to allow remote jmx connections. With VisualVM you'll be able to connect to the JVM and check the activity.

You can also set up MBeans to keep stats of the running process. Which you'll be able to check also with VisualVM.

like image 38
Jan Goyvaerts Avatar answered Apr 17 '26 10:04

Jan Goyvaerts



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!