Skip to content

Commit ec4f846

Browse files
committed
Renaming lockForMillis to lockAtMostFor
1 parent c62d781 commit ec4f846

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void scheduledTask() {
4343
4444
The `@SchedulerLock` annotation has several purposes. First of all, only annotated methods are locked, the library ignores
4545
all other scheduled tasks. You also have to specify the name for the lock. Only one tasks with the same name can be executed
46-
at the same time. Lastly, you can set `lockForMillis` attribute which specifies how long the lock should be kept in case the
46+
at the same time. Lastly, you can set `lockAtMostFor` attribute which specifies how long the lock should be kept in case the
4747
executing node dies. This is just a fallback, under normal circumstances the lock is released as soon the tasks finishes.
4848

4949
### Configure the task scheduler
@@ -167,3 +167,10 @@ public void run() {
167167

168168
}
169169
```
170+
171+
172+
#Change log
173+
174+
## 0.3.0
175+
1. `@ShedlulerLock.name` made obligatory
176+
2. `@ShedlulerLock.lockForMillis` renamed to lockAtMostFor

shedlock-core/src/main/java/net/javacrumbs/shedlock/core/SchedulerLock.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
/**
1212
* Lock name.
1313
*/
14-
String name() default "";
14+
String name();
1515

1616
/**
17-
* How long the lock should be kept in case the machine which obtained the lock died before releasing it.
18-
* This is just a fallback, under normal circumstances the lock is released as soon the tasks finishes
17+
* How long (in ms) the lock should be kept in case the machine which obtained the lock died before releasing it.
18+
* This is just a fallback, under normal circumstances the lock is released as soon the tasks finishes.
19+
*
20+
* Ignored when using ZooKeeper and other lock providers which are able to detect dead node.
1921
*/
20-
long lockForMillis() default 60 * 60 * 1000;
22+
long lockAtMostFor() default 60 * 60 * 1000;
2123
}

shedlock-spring/src/main/java/net/javacrumbs/shedlock/spring/SpringLockConfigurationExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public Optional<LockConfiguration> getLockConfiguration(Runnable task) {
4141
Method method = ((ScheduledMethodRunnable) task).getMethod();
4242
SchedulerLock annotation = AnnotationUtils.findAnnotation(method, SchedulerLock.class);
4343
if (shouldLock(annotation)) {
44-
return Optional.of(new LockConfiguration(annotation.name(), now().plus(annotation.lockForMillis(), MILLIS)));
44+
return Optional.of(new LockConfiguration(annotation.name(), now().plus(annotation.lockAtMostFor(), MILLIS)));
4545
}
4646
}
4747
return Optional.empty();

shedlock-spring/src/test/java/net/javacrumbs/shedlock/spring/SpringLockConfigurationExtractorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void methodWithoutAnnotation() {
3434

3535
}
3636

37-
@SchedulerLock(name = "lockName", lockForMillis = 10)
37+
@SchedulerLock(name = "lockName", lockAtMostFor = 10)
3838
public void annotatedMethod() {
3939

4040
}

0 commit comments

Comments
 (0)