public class X25519KeyFactory extends I2PThread implements KeyFactory
Pool sizes scale dynamically based on memory headroom, CPU pressure,
and connection demand. The Tuner calls refreshPoolSize() every
30 seconds to adapt to changing conditions.
I2PThread.OOMEventListenerThread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
X25519KeyFactory(I2PAppContext ctx)X25519KeyFactory. |
| Modifier and Type | Method and Description |
|---|---|
(package private) void | computeTargetSizes()Dynamically compute target pool sizes based on real-time system signals. |
static X25519KeyFactory | getInstance()Returns the last created instance. |
KeyPair | getKeys()Pulls a prebuilt keypair from the queue,
or if not available, construct a new one. |
int | getMaxSize()Returns the current maximum precalc queue size. |
int | getMinSize()Returns the current minimum precalc queue size. |
int | getSize()Returns the current number of precalc keys queued. |
void | recordEmpty()Record an empty-queue event for demand tracking. |
void | refreshPoolSize()Called by the Tuner every 30 seconds. |
void | returnUnused(KeyPair kp)Return an unused DH key builder
to be put back onto the queue for reuse. |
void | run()run. |
void | setMaxSize(int max)Sets the maximum precalc queue size. |
void | setMinSize(int min)Sets the minimum precalc queue size. |
void | shutdown()Note that this stops the singleton precalc thread. |
addOOMEventListener, fireOOM, removeOOMEventListener, startactiveCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yieldpublic X25519KeyFactory(I2PAppContext ctx)
void computeTargetSizes()
Signals used:
Memory budget: up to 2% of free heap when active, 0.5% when idle.
public static X25519KeyFactory getInstance()
public KeyPair getKeys()
getKeys in interface KeyFactorypublic int getMaxSize()
public int getMinSize()
public int getSize()
public void recordEmpty()
getKeys() when the pool is depleted.public void refreshPoolSize()
public void returnUnused(KeyPair kp)
public void setMaxSize(int max)
public void setMinSize(int min)
public void shutdown()