java.lang.Object
java.util.AbstractMap<Hash, SessionKey>
java.util.concurrent.ConcurrentHashMap<Hash, SessionKey>
net.i2p.util.KeyRing
net.i2p.router.PersistentKeyRing
- All Implemented Interfaces:
Serializable, ConcurrentMap<Hash, SessionKey>, Map<Hash, SessionKey>
ConcurrentHashMap with backing in the
router.config file. router.keyring.key.{base64 hash, with = replaced with $}={base64 session key} Caution - not all HashMap methods are overridden.- See Also:
Nested Class Summary
Nested classes/interfaces inherited from class ConcurrentHashMap
ConcurrentHashMap.KeySetView<K,V> Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe context whose properties hold the keys.private static final StringStart of each stored key's property name.private static final longPinned for serialized-form compatibility.Constructor Summary
ConstructorsConstructorDescriptionRetains the context and loads any keys already persisted in the router config.Method Summary
Modifier and TypeMethodDescriptionprivate voidLoads the keys saved in the router's properties.put(Hash h, SessionKey sk) Store a session key, persisting it to the router config.Remove a session key, clearing it from the router config.Methods inherited from class ConcurrentHashMap
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, valuesMethods inherited from class AbstractMap
clone
Field Details
serialVersionUID
private static final long serialVersionUIDPinned for serialized-form compatibility.- See Also:
_ctx
The context whose properties hold the keys.PROP_PFX
Start of each stored key's property name.- See Also:
Constructor Details
PersistentKeyRing
Retains the context and loads any keys already persisted in the router config.- Parameters:
ctx- the router context, retained so keys can reachrouter.config
Method Details
put
Store a session key, persisting it to the router config.- Specified by:
putin interfaceMap<Hash, SessionKey>- Overrides:
putin classConcurrentHashMap<Hash, SessionKey>- Parameters:
h- the destination hashsk- the session key- Returns:
- the previous key, or null
remove
Remove a session key, clearing it from the router config.- Specified by:
removein interfaceMap<Hash, SessionKey>- Overrides:
removein classConcurrentHashMap<Hash, SessionKey>- Parameters:
o- the destination hash or key- Returns:
- the previous key, or null
addFromProperties
private void addFromProperties()Loads the keys saved in the router's properties.