best practices for intermittent connectivity
"John D. Blair" <[email protected]> Fri, 9 Sep 2005 16:56:49 -0700
| Newsgroups | gmane.comp.java.jxta.user |
|---|---|
| Message-ID | <[email protected]> |
In the JXTA application I am developing I have many peers which are sending data to a smaller number of remote peers. For any number of reasons it is always possible that a remote peer will become unreachable. When a remote peer is unreachable the local peer should find another peer that is reachable providing the same service, and continue operation. My question is: Can somebody provide me with an example of how to discover that the remote endpoint on a unicast pipe has become unreachable, and recover from this? I see from the documentation that OutputPipe.send() returns a boolean that, if false, usually indicates there is congestion and the peer should try again later. How long should I wait? Should I implement an exponential backoff algorithm? How many times should I retry before giving up? Is this actually a rare event that I don't need to expend much effort on? I can experiment, but I am hoping to find some suggestions. Also, I see that OutputPipe.send() can throw IOException. When this is thrown does it always mean the remote peer has become unreachable, or can it indicate other problems? If I catch this exception, should I close the pipe and try to open it again, and find another peer only if that fails? Or can I assume this means peer is gone? Or should I use some other means to probe if the peer is there? Or, better yet, am I missing some functionality in JXTA that will take care of this for me? thanks much! -john.