public class Peers extends java.util.TreeMap<byte[],Peer> implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private long |
lastBootstrap |
private static ConcurrentLog |
log |
private static long |
serialVersionUID |
Constructor and Description |
---|
Peers() |
Modifier and Type | Method and Description |
---|---|
void |
add(Peer peer)
add a new peer to the list of peers
|
void |
bootstrap(java.lang.String[] peers,
int selection)
this method must be called once to bootstrap a list of network peers.
|
static java.lang.String[] |
bootstrapList(java.util.List<Peer> peers)
convenient method to produce a list of bootstrap peer addresses from given peer lists
|
Peer |
get(java.lang.String hash)
get a peer using the peer hash
|
static void |
main(java.lang.String[] args) |
void |
refresh()
refresh() gets a new network list from one random remote peer once every
minute.
|
java.util.List<Peer> |
select(boolean requireNode,
boolean requireSolr)
select a list of peers according to special needs.
|
ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, remove, size, subMap, subMap, tailMap, tailMap, values
private static final ConcurrentLog log
private static final long serialVersionUID
private long lastBootstrap
public void refresh()
public void bootstrap(java.lang.String[] peers, int selection)
peers
- a list of known peersselection
- number of peers which are taken from the given list of peers for bootstrapingpublic void add(Peer peer)
peer
- public Peer get(java.lang.String hash)
hash
- public java.util.List<Peer> select(boolean requireNode, boolean requireSolr)
requireNode
- must be true to select only peers which are node peersrequireSolr
- must be true to select only peers which support the solr interfacepublic static java.lang.String[] bootstrapList(java.util.List<Peer> peers)
peers
- public static void main(java.lang.String[] args)