Package net.javacrumbs.shedlock.core
Class AbstractSimpleLock
- java.lang.Object
-
- net.javacrumbs.shedlock.core.AbstractSimpleLock
-
- All Implemented Interfaces:
SimpleLock
public abstract class AbstractSimpleLock extends Object implements SimpleLock
-
-
Field Summary
Fields Modifier and Type Field Description protected LockConfiguration
lockConfiguration
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSimpleLock(LockConfiguration lockConfiguration)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Optional<SimpleLock>
doExtend(LockConfiguration newConfiguration)
protected abstract void
doUnlock()
@NotNull Optional<SimpleLock>
extend(@NotNull Instant lockAtMostUntil, @NotNull Instant lockAtLeastUntil)
Extends the lock.void
unlock()
Unlocks the lock.
-
-
-
Field Detail
-
lockConfiguration
protected final LockConfiguration lockConfiguration
-
-
Constructor Detail
-
AbstractSimpleLock
protected AbstractSimpleLock(LockConfiguration lockConfiguration)
-
-
Method Detail
-
unlock
public final void unlock()
Description copied from interface:SimpleLock
Unlocks the lock. Once you unlock it, you should not use for any other operation.- Specified by:
unlock
in interfaceSimpleLock
-
doUnlock
protected abstract void doUnlock()
-
extend
@NotNull public final @NotNull Optional<SimpleLock> extend(@NotNull @NotNull Instant lockAtMostUntil, @NotNull @NotNull Instant lockAtLeastUntil)
Description copied from interface:SimpleLock
Extends the lock. If the lock can be extended a new lock is returned. After calling extend, no other operation can be called on current lock.This method is NOT supported by all lock providers.
- Specified by:
extend
in interfaceSimpleLock
- Returns:
- a new lock or empty optional if the lock can not be extended
-
doExtend
protected Optional<SimpleLock> doExtend(LockConfiguration newConfiguration)
-
-