Don't Rely on remotePublish()
By mduigou on Apr 20, 2007
Since it's earliest versions the JXTA JSE API has included remotePublish() as part of the Discovery API. This is unfortunate because remotePublish() is frequently misused and it's not really that useful to begin with. Some JXTA users assume that advertisements must be remote published to another peer in order for the advertisement to be discovered. This is not true! Unless the advertisement needs to discoverable while the peer is unreachable or offline then local publication is almost always sufficient. Part of the confusion is undoubtably due to the presence of two methods, publish() and remotePublish(). In the JXTA JSE and JXTA-C APIs remotePublish() and publish() are separate APIs for implementation efficiency reasons only. You should consider advertisement publication as only one concept--the publish operation with an option for remote republication. Remote publication is intended to be only a means for easily requesting remote republication. In every case where remotePublish() is used it should be accompanied by appropriate local publication. What remotePublish() does : send the provided advertisement to remote peers who may republish the advertisement locally. There a couple of big question marks that should arise from this statement.
- What is gained by having the other peers republish one of my advertisements?
- Which other peers will be receiving the advertisement?
- Will the peers which receive the advertisement accept my request and actually publish my advertisement?