tomp2p/TomP2P — pull request #73 by sebastian-stephan (2014-12-28 16:18:35+00:00)
Title: RTT measurements, customizable priorities for routing and customizable kademlia bucket sizes.

This pull request introduces:
* PeerMap bucket sizes can now be configured in the PeerMapConfiguration. The default sizes were changed from 20 for all buckets to 128, 64, 32, 16 for the largest (most distant) buckets and 8 for the remaining buckets.
* The [RTT](https://github.com/sebastian-stephan/TomP2P/blob/add-rtt/core/src/main/java/net/tomp2p/peers/RTT.java) (Round-Trip-Time) of requests are measured and saved in the [PeerStatistic](https://github.com/sebastian-stephan/TomP2P/blob/add-rtt/core/src/main/java/net/tomp2p/peers/PeerStatistic.java) objects in the PeerMap. The RTT from reported peers are estimated using the RTT of the referrer. A moving average of the last 5 measurments is kept at all time.
* A customizable comparator (Interface [PeerStatisticComparator](https://github.com/sebastian-stephan/TomP2P/blob/add-rtt/core/src/main/java/net/tomp2p/p2p/PeerStatisticComparator.java)) can be configured in the PeerMapConfiguration to prioritise peers based on metrics in the PeerStatistic such as average RTT, number of times seen, last time online, etc. This can be used to improve performance and balance load. A sample comparator that prioritises over RTT is also added ([RTTStatisticComparator](https://github.com/sebastian-stephan/TomP2P/blob/add-rtt/core/src/main/java/net/tomp2p/p2p/RTTPeerStatisticComparator.java)).
* The routing mechanism will use the above comparator during the routing process when selecting the next peer to ask. It is also used when sorting peers in a neighbor rpc call.

Additionally some code cleanup has been done such as optimized imports, typos and wrong JavaDoc parameters.