Skip to content

Commit

Permalink
Simulate longer task runs with sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabby Anandan committed Aug 17, 2020
1 parent 341c21a commit 49afa5f
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import javax.imageio.ImageIO;
import java.io.File;
import java.net.URL;
import java.util.Random;

@EnableTask
@EnableBatchProcessing
Expand All @@ -31,6 +32,8 @@ public class ThumbinatorApplication {

String READY_THUMBNAIL_IMG = "/tmp/ready/dataflow-icon-thumb-ready.png";

Random random = new Random();

@Autowired
public JobBuilderFactory jobBuilderFactory;

Expand Down Expand Up @@ -86,6 +89,8 @@ public RepeatStatus execute(StepContribution contribution, ChunkContext chunkCon
.println("##### THUMBNAIL DRAFT is: [" + draftThumbnail.length()
+ "] bytes #####");

Thread.sleep(random.nextInt(10000));

System.out.println("Job-1 + Step-2 FINISHED");
return RepeatStatus.FINISHED;
}
Expand All @@ -112,6 +117,8 @@ public RepeatStatus execute(StepContribution contribution, ChunkContext chunkCon

thumbnailFrom.renameTo(thumbnailTo);

Thread.sleep(random.nextInt(10000));

System.out.println(
"##### THUMBNAIL DRAFT is: [" + thumbnailFromSize
+ "] bytes / THUMBNAIL READY is: ["
Expand All @@ -135,6 +142,8 @@ public Job statusImage() {
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext)
throws Exception {

Thread.sleep(random.nextInt(10000));

System.out.println(
"##### ORIGINAL is: [" + new File(ORIGINAL_IMG).length()
+ "] bytes / THUMBNAIL is: ["
Expand Down

0 comments on commit 49afa5f

Please sign in to comment.