简体   繁体   English

在线托管Java程序是否在某些时段运行?

[英]Run Java program at certain periods, hosted online?

I'm fairly new to running programs from servers. 我对从服务器运行程序还很陌生。

I have a program built in Java. 我有一个用Java构建的程序。 I want to run that program every few minutes and update the new results. 我想每隔几分钟运行该程序并更新新结果。 I can do this from my computer but I have to leave it on, with internet, etc... 我可以从我的计算机上执行此操作,但是我必须将其保留在互联网上等。

I figured I could host this somewhere and have it do this for me, and then send me JSON results. 我想我可以将其托管在某个地方,并为我执行此操作,然后向我发送JSON结果。 What is the design pattern to do this? 这样做的设计模式是什么?

I have built apis using php but never Java. 我已经使用php构建了api,但从未使用Java。 Any suggestions? 有什么建议么? Thanks 谢谢

This would depend entirely on the host. 这将完全取决于主机。

Any cloud server ( Amazon EC2 , Rackspace , GoGrid ) where you can provision your own virtual server would be perfect for this. 可以在其中配置自己的虚拟服务器的任何云服务器( Amazon EC2RackspaceGoGrid )都将是完美的选择。 Since you can SSH or Remote in, you can setup a cron job or NT Scheduler job to run your Java program. 由于可以SSH或远程登录,因此可以设置cron作业或NT Scheduler作业来运行Java程序。

Also, services like Heroku (and I believe Windows Azure) let you provision worker instances, which can do this sort of job. 此外,诸如Heroku (我相信Windows Azure)之类的服务还允许您设置工作程序实例,从而可以完成此类工作。 For Heroku, check out background workers . 对于Heroku,请查看后台工作者

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM