Skip to content

Commit

Permalink
Test fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-krecan committed Jan 21, 2022
1 parent 11e3971 commit a5c2bfa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.Duration;
import java.util.Date;

import static java.time.Duration.ZERO;
import static net.javacrumbs.shedlock.core.LockAssert.assertLocked;
import static net.javacrumbs.shedlock.core.LockExtender.extendActiveLock;

@Component
public class ScheduledTasks {
@Scheduled(fixedRate = 100)
@SchedulerLock(name = "reportCurrentTime", lockAtMostFor = "${lock.at.most.for}")
public void reportCurrentTime() {
assertLocked();
extendActiveLock(Duration.ofMillis(5), ZERO);
System.out.println(new Date());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,16 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.Duration;
import java.util.Date;

import static java.time.Duration.ZERO;
import static net.javacrumbs.shedlock.core.LockAssert.assertLocked;
import static net.javacrumbs.shedlock.core.LockExtender.extendActiveLock;

@Component
public class ScheduledTasks {
@Scheduled(fixedRate = 100)
@SchedulerLock(name = "reportCurrentTime", lockAtMostFor = "${lock.at.most.for}")
public void reportCurrentTime() {
assertLocked();
extendActiveLock(Duration.ofMillis(5), ZERO);
System.out.println(new Date());
}
}

0 comments on commit a5c2bfa

Please sign in to comment.