java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.KeyManager.SynchronizeKeysJob
- All Implemented Interfaces:
Job
- Enclosing class:
KeyManager
Read/Write the 4 files in keyBackup/ As of 0.9.4 this is run on-demand only, there's no need to periodically sync. Actually, there's little need for this at all. If
router.keys is corrupt, we should just make a new router identity, there's no real reason to try so hard to recover our old keys.Field Summary
Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptiongetName()Return the name.voidrunJob()Execute the job.private DataStructuresyncKey(File keyFile, DataStructure structure, boolean exists) Synchronize the given structure with the file on disk.private voidSynchronizes the router keys with the files in the directory.private voidsyncPrivateKey(File keyDir) Synchronizes the private key with its file.private voidsyncPublicKey(File keyDir) Synchronizes the public key with its file.private voidsyncSigningKey(File keyDir, SigType type) Synchronize the signing private key with the file on disk.private voidsyncVerificationKey(File keyDir, SigType type) Synchronize the signing public key with the file on disk.Methods inherited from class JobImpl
dropped, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue, toStringModifier and TypeMethodDescriptionvoiddropped()Default implementation does nothing.final RouterContextThe router context that this job belongs to.longgetJobId()The unique job ID for this job.longThe timestamp when this job was last made ready for execution.The timing object for this job.voidmadeReady(long now) For JobQueue only, not for external use.protected voidrequeue(long delayMs) Requeue this job to run after the specified delay.toString()
Constructor Details
SynchronizeKeysJob
public SynchronizeKeysJob()Builds the key synchronization job.
Method Details
runJob
public void runJob()Execute the job.syncKeys
Synchronizes the router keys with the files in the directory.- Parameters:
keyDir- the key directory
syncPrivateKey
Synchronizes the private key with its file.- Parameters:
keyDir- the key directory
syncPublicKey
Synchronizes the public key with its file.- Parameters:
keyDir- the key directory
syncSigningKey
syncVerificationKey
syncKey
Synchronize the given structure with the file on disk.- Parameters:
keyFile- the file holding the serialized structurestructure- non-null, filled-in if exists is true, or without data if exists is falseexists- write to file if true, read from file if false- Returns:
- structure or null on read error
getName