From c274d9177e4a495e7b793120dfd1ce12fa5632c7 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 15 Apr 2013 19:40:00 +0200 Subject: o Using the returned references to wait for completion. --- src/main/java/io/trygvis/queue/AsyncService.java | 13 ++++++++ .../java/io/trygvis/queue/JpaAsyncService.java | 37 ++++++++++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) (limited to 'src/main/java/io/trygvis/queue') diff --git a/src/main/java/io/trygvis/queue/AsyncService.java b/src/main/java/io/trygvis/queue/AsyncService.java index f792f5e..b08db1f 100755 --- a/src/main/java/io/trygvis/queue/AsyncService.java +++ b/src/main/java/io/trygvis/queue/AsyncService.java @@ -2,6 +2,8 @@ package io.trygvis.queue; import org.quartz.*; +import java.util.*; + public interface AsyncService { JpaAsyncService.JpaQueueRef registerQueue(String name, int interval, AsyncCallable callable) throws SchedulerException; @@ -10,10 +12,21 @@ public interface AsyncService getArguments(); + + Date getScheduled(); + + Date getLastRun(); + + Date getCompleted(); + + boolean isDone(); } interface AsyncCallable { diff --git a/src/main/java/io/trygvis/queue/JpaAsyncService.java b/src/main/java/io/trygvis/queue/JpaAsyncService.java index 95d5ef3..e715ac7 100755 --- a/src/main/java/io/trygvis/queue/JpaAsyncService.java +++ b/src/main/java/io/trygvis/queue/JpaAsyncService.java @@ -101,6 +101,11 @@ public class JpaAsyncService implements AsyncService getArguments() { + return Arrays.asList(task.getArguments()); + } + + public Date getScheduled() { + return task.getScheduled(); + } + + public Date getLastRun() { + return task.getLastRun(); + } + + public Date getCompleted() { + return task.getCompleted(); + } + + public boolean isDone() { + return task.isDone(); + } + public String toString() { return "JpaExecutionRef{" + "task=" + task + @@ -129,6 +154,12 @@ public class JpaAsyncService implements AsyncService