Top Description Fields Constructors Methods
org.eclipse.jgit.transport.sshd

public Class JGitKeyCache

extends Object
implements KeyCache
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.transport.sshd.KeyCache
Imports
java.nio.file.Path, java.security.KeyPair, .PrivateKey, java.util.Map, java.util.concurrent.ConcurrentHashMap, java.util.concurrent.atomic.AtomicReference, java.util.function.Function, javax.security.auth.DestroyFailedException

A simple KeyCache. JGit uses one such cache in its SshdSessionFactory to avoid loading keys multiple times.
Since
5.2

Field Summary

Modifier and TypeField and Description
private AtomicReference<Map<Path, KeyPair>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements org.eclipse.jgit.transport.sshd.KeyCache.close.

Removes all KeyPair from this cache and destroys their private keys.

public KeyPair
get(Path
of the key
path
,
Function<? super Path, ? extends KeyPair>
to load the key if it isn't present in the cache yet
loader
)

Implements org.eclipse.jgit.transport.sshd.KeyCache.get.

Obtains a KeyPair from the cache.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheback to summary
private AtomicReference<Map<Path, KeyPair>> cache

Constructor Detail

JGitKeyCacheback to summary
public JGitKeyCache()

Method Detail

closeback to summary
public void close()

Implements org.eclipse.jgit.transport.sshd.KeyCache.close.

Doc from org.eclipse.jgit.transport.sshd.KeyCache.close.

Removes all KeyPair from this cache and destroys their private keys. This cache instance must not be used anymore thereafter.

Annotations
@Override
getback to summary
public KeyPair get(Path path, Function<? super Path, ? extends KeyPair> loader)

Implements org.eclipse.jgit.transport.sshd.KeyCache.get.

Doc from org.eclipse.jgit.transport.sshd.KeyCache.get.

Obtains a KeyPair from the cache. Implementations must be thread-safe.

Parameters
path:Path

of the key

loader:Function<? super Path, ? extends KeyPair>

to load the key if it isn't present in the cache yet

Returns:KeyPair

the KeyPair, or null if not present and could not be loaded

Annotations
@Override