To handle discovery I am going to run it in a seperate thread, which say run's every 15-30 seconds - is this a good idea or is there better ways to handle it?
The best way is to implement a DiscoveryListener and process each response on DiscoveryEvent. You have a great example on the programmer's guide.
> The best way is to implement a DiscoveryListener and process each response on DiscoveryEvent.
This is what I have already. Sorry my question might not have been clear, when my program is running I want to send a Discovery query every 15-30 seconds (In order to check for new peers joining the network at anytime).
I could do this in a while loop running in a seperate thread but I wanted to check if there was any other ways or better ways to do it?
I'm programming an application with similar characteristic. When a peer joins a group, he sends a HELLO message through the common pipe (a propagated one) with his name and his peerID. Furthermore I schedule a task that do a getRemoteAdvertisement every 10-15min.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.