Package pgp.cert_d.backend
Class InMemoryCertificateDirectoryBackend.ObjectLockingMechanism
- java.lang.Object
-
- pgp.cert_d.backend.InMemoryCertificateDirectoryBackend.ObjectLockingMechanism
-
- All Implemented Interfaces:
PGPCertificateDirectory.LockingMechanism
- Enclosing class:
- InMemoryCertificateDirectoryBackend
protected static class InMemoryCertificateDirectoryBackend.ObjectLockingMechanism extends java.lang.Object implements PGPCertificateDirectory.LockingMechanism
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedObjectLockingMechanism()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisLocked()Return true if the lock is in locked state.voidlockDirectory()Lock the store for writes.voidreleaseDirectory()Release the directory write-lock acquired viaPGPCertificateDirectory.LockingMechanism.lockDirectory().booleantryLockDirectory()Try top lock the store for writes.
-
-
-
Method Detail
-
lockDirectory
public void lockDirectory() throws java.lang.InterruptedExceptionDescription copied from interface:PGPCertificateDirectory.LockingMechanismLock the store for writes. Readers can continue to use the store and will always see consistent certs.- Specified by:
lockDirectoryin interfacePGPCertificateDirectory.LockingMechanism- Throws:
java.lang.InterruptedException- if the thread gets interrupted
-
tryLockDirectory
public boolean tryLockDirectory()
Description copied from interface:PGPCertificateDirectory.LockingMechanismTry top lock the store for writes. Return false without locking the store in case the store was already locked.- Specified by:
tryLockDirectoryin interfacePGPCertificateDirectory.LockingMechanism- Returns:
- true if locking succeeded, false otherwise
-
isLocked
public boolean isLocked()
Description copied from interface:PGPCertificateDirectory.LockingMechanismReturn true if the lock is in locked state.- Specified by:
isLockedin interfacePGPCertificateDirectory.LockingMechanism- Returns:
- true if locked
-
releaseDirectory
public void releaseDirectory()
Description copied from interface:PGPCertificateDirectory.LockingMechanismRelease the directory write-lock acquired viaPGPCertificateDirectory.LockingMechanism.lockDirectory().- Specified by:
releaseDirectoryin interfacePGPCertificateDirectory.LockingMechanism
-
-