Summary


After reading through the sample applications in this and the previous chapter, you might wonder why you should go to the trouble of programming with the JXTA APIs, when you could just send messages between peers via simple Java sockets, or pass information as parameters in remote method invocations. To see the benefit JXTA brings to an application, you might want to set up a small experiment.

If you are able to use two or more computers, start up several peers with the prime-finding service. Then, start at least one peer with the client application, or the JXTA Shell with the primefind command installed. After issuing a few requests from your client peer, disconnect one of the peers offering the service and change that host's IP address. Or, if you can, put that host on a different network partition altogether. Next, start up that peer again, and issue the prime search commands from the client.

This experiment should show that, although a peer changed its network, or physical identity, its virtual identity on the JXTA network remained the same. When the client tries to connect to that peer's input pipe, the underlying JXTA implementation will realize that one of the pipe endpoints moved. The implementation will then try to discover the new endpoint location and reconnect the pipe. That searching and reconnecting is hidden from a client application of the JXTA implementation. In addition, note that at no time does the prime-finding service use centralized naming and directory services all endpoint resolutions and message deliveries take place via JXTA's capability to manage virtual network identities.

Another important item to note about these sample applications is that peers can be programmed in any programming language. On the application level, the only agreement between peers is the wire protocol specified by the prime-finding service. That wire protocol defines what messages are exchanged, and what format those messages must follow. A developer has to know only that wire protocol to provide new clients for the prime number search service. On a lower level, peers need only implement the JXTA protocols. At no point does any peer depend on the Java language, or the presence of a Java virtual machine some peers might use JXTA's C binding, others might be implemented in C# or Python. As long as each peer provides a correct JXTA binding, and as long as each of those bindings implements the needed JXTA protocols, peer interaction can take place.



JavaT P2P Unleashed
JavaT P2P Unleashed
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 209

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net