开发者

Run program on remote PC using Java

I am creating an application in which I have a central (server?) PC.

When at a particular position (or event) in the central PC, a XML file is dumped. The program reads that XML in which remote PC IP is given (any PC). The command is transmitted to that PC, that PC will execute that command.

The command may be one of various types and for each command that PC has a separate class file. Per command it will create an object of that type and run the desired metho开发者_C百科d.

Question: What is the best technology with which I can implement this architecture?


Ok, what is your question?

The simplest way to do this may be to use RMI.

However, have you considered using a JMS queue as this would allow you to distribute the work evenly across many PCs without having to allocate a specific PC to a specific task. i.e. you give a queue the tasks you want to perform and the next available PC performs that task.


Take a look at Java RMI

Obligatory Wiki link and quote and why this can apply to your implementation:

The Java Remote Method Invocation Application Programming Interface (API), or Java RMI, is a Java application programming interface that performs the object-oriented equivalent of remote procedure calls (RPC). (even across machine boundaries)


RMI is also the first that came up in my mind. But I think to give a really good answer we need some more details about what is done on the remote PC. My guess is that you are building a distributed Worker Thread Pattern

Other options can be:

JMS. Web Services. Etc.


You have several options.. You can use RMI, you can have a JMS Queue/Topic or even a Http Pub/sub. Each one of these has pros/cons.

With RMI, you can make the remote PCs open a connection to the server on startup to avoid the firewall issues. This way you only need to open the incoming/outgoing ports only on your central PC.

With JMS, you can register a listener from each of the remote PCs to a Topic/Queue opened by your JMS container. Any message you put in the Queue/Topic, you have a message filter set by using IP that way the message will only go to one targeted PC. I like this approach because of the lose coupling between your remote PCs and Central PC. But in this approach, since you don't have an open connection between your remote and your central pc, your Central PC will not have the similar control that you would get in the RMI system.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜