You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ro...@apache.org on 2019/10/02 15:48:00 UTC

[james-project] branch master updated (e0cfb68 -> 4dd45cd)

This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git.


    from e0cfb68  JAMES-2563 Implement ElasticSearch healthCheck
     new 4a377d4  JAMES-2813 add task type for CleanupTasksPerformer
     new a30e571  JAMES-2813 add task type for Migration subtasks
     new 983a56d  JAMES-2813 wrap all lambda as task into a MemoryReferenceTask in test
     new 4dd45cd  JAMES-2813 remove default type in Task

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../backends/cassandra/migration/Migration.java    | 13 +++++-
 server/container/cli-integration/pom.xml           |  7 ++-
 .../james/cli/ReindexCommandIntegrationTest.java   |  5 ++-
 .../org/apache/james/CleanupTasksPerformer.java    |  5 ++-
 server/protocols/webadmin/webadmin-core/pom.xml    |  6 +++
 .../james/webadmin/routes/TasksRoutesTest.java     | 51 +++++++++++-----------
 .../src/main/java/org/apache/james/task/Task.java  |  5 +--
 .../org/apache/james/task/MemoryReferenceTask.java | 14 ++++--
 .../james/task/SerialTaskManagerWorkerTest.java    |  8 ++--
 .../java/org/apache/james/task/TaskWithIdTest.java |  6 +--
 .../EventSourcingTaskManagerTest.java              |  9 ++--
 11 files changed, 81 insertions(+), 48 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[james-project] 02/04: JAMES-2813 add task type for Migration subtasks

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit a30e5711a16a6f510acc74918aa221cd7e0ceec4
Author: Rémi KOWALSKI <rk...@linagora.com>
AuthorDate: Wed Oct 2 10:05:14 2019 +0200

    JAMES-2813 add task type for Migration subtasks
---
 .../james/backends/cassandra/migration/Migration.java       | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/migration/Migration.java b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/migration/Migration.java
index 514b7ca..ff5092b 100644
--- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/migration/Migration.java
+++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/migration/Migration.java
@@ -20,13 +20,24 @@
 package org.apache.james.backends.cassandra.migration;
 
 import org.apache.james.task.Task;
+import org.apache.james.task.TaskType;
 
 public interface Migration {
 
     void apply() throws InterruptedException;
 
     default Task asTask() {
-        return this::runTask;
+        return new Task() {
+            @Override
+            public Result run() throws InterruptedException {
+                return runTask();
+            }
+
+            @Override
+            public TaskType type() {
+                return TaskType.of("migration_sub_task");
+            }
+        };
     }
 
     default Task.Result runTask() throws InterruptedException {


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[james-project] 03/04: JAMES-2813 wrap all lambda as task into a MemoryReferenceTask in test

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 983a56d8cf005193166aa758e4226400f87bd203
Author: Rémi KOWALSKI <rk...@linagora.com>
AuthorDate: Wed Oct 2 10:06:36 2019 +0200

    JAMES-2813 wrap all lambda as task into a MemoryReferenceTask in test
---
 server/container/cli-integration/pom.xml           |  7 ++-
 .../james/cli/ReindexCommandIntegrationTest.java   |  5 ++-
 server/protocols/webadmin/webadmin-core/pom.xml    |  6 +++
 .../james/webadmin/routes/TasksRoutesTest.java     | 51 +++++++++++-----------
 .../org/apache/james/task/MemoryReferenceTask.java | 14 ++++--
 .../james/task/SerialTaskManagerWorkerTest.java    |  8 ++--
 .../java/org/apache/james/task/TaskWithIdTest.java |  6 +--
 .../EventSourcingTaskManagerTest.java              |  9 ++--
 8 files changed, 64 insertions(+), 42 deletions(-)

diff --git a/server/container/cli-integration/pom.xml b/server/container/cli-integration/pom.xml
index 5fdaaed..b78c433 100644
--- a/server/container/cli-integration/pom.xml
+++ b/server/container/cli-integration/pom.xml
@@ -65,7 +65,12 @@
             <artifactId>james-server-memory-guice</artifactId>
             <scope>test</scope>
         </dependency>
-
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-task-api</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
             <artifactId>testing-base</artifactId>
diff --git a/server/container/cli-integration/src/test/java/org/apache/james/cli/ReindexCommandIntegrationTest.java b/server/container/cli-integration/src/test/java/org/apache/james/cli/ReindexCommandIntegrationTest.java
index 6d81781..c1ff23f 100644
--- a/server/container/cli-integration/src/test/java/org/apache/james/cli/ReindexCommandIntegrationTest.java
+++ b/server/container/cli-integration/src/test/java/org/apache/james/cli/ReindexCommandIntegrationTest.java
@@ -31,6 +31,7 @@ import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.store.search.ListeningMessageSearchIndex;
 import org.apache.james.modules.server.JMXServerModule;
+import org.apache.james.task.MemoryReferenceTask;
 import org.apache.james.task.Task;
 import org.junit.After;
 import org.junit.Before;
@@ -50,8 +51,8 @@ public class ReindexCommandIntegrationTest {
     @Before
     public void setUp() throws Exception {
         reIndexer = mock(ReIndexer.class);
-        when(reIndexer.reIndex()).thenReturn(() -> Task.Result.COMPLETED);
-        when(reIndexer.reIndex(any(MailboxPath.class))).thenReturn(() -> Task.Result.COMPLETED);
+        when(reIndexer.reIndex()).thenReturn(new MemoryReferenceTask(() -> Task.Result.COMPLETED));
+        when(reIndexer.reIndex(any(MailboxPath.class))).thenReturn(new MemoryReferenceTask(() -> Task.Result.COMPLETED));
         guiceJamesServer = memoryJmap.jmapServer(new JMXServerModule(),
             binder -> binder.bind(ListeningMessageSearchIndex.class).toInstance(mock(ListeningMessageSearchIndex.class)))
             .overrideWith(binder -> binder.bind(ReIndexer.class)
diff --git a/server/protocols/webadmin/webadmin-core/pom.xml b/server/protocols/webadmin/webadmin-core/pom.xml
index 4c39d4e..606ec07 100644
--- a/server/protocols/webadmin/webadmin-core/pom.xml
+++ b/server/protocols/webadmin/webadmin-core/pom.xml
@@ -59,6 +59,12 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-task-api</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>james-server-task-memory</artifactId>
             <scope>test</scope>
         </dependency>
diff --git a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/TasksRoutesTest.java b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/TasksRoutesTest.java
index b119037..c34baa4 100644
--- a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/TasksRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/TasksRoutesTest.java
@@ -34,6 +34,7 @@ import java.util.UUID;
 import java.util.concurrent.CountDownLatch;
 
 import org.apache.james.task.Hostname;
+import org.apache.james.task.MemoryReferenceTask;
 import org.apache.james.task.MemoryTaskManager;
 import org.apache.james.task.Task;
 import org.apache.james.task.TaskId;
@@ -87,11 +88,11 @@ class TasksRoutesTest {
     @Test
     void listShouldReturnTaskDetailsWhenTaskInProgress() throws Exception {
         CountDownLatch taskInProgressLatch = new CountDownLatch(1);
-        TaskId taskId = taskManager.submit(() -> {
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> {
             taskInProgressLatch.countDown();
             waitForResult();
             return Task.Result.COMPLETED;
-        });
+        }));
 
         taskInProgressLatch.await();
 
@@ -123,11 +124,11 @@ class TasksRoutesTest {
     @Test
     void listShouldListTaskWhenStatusFilter() throws Exception {
         CountDownLatch inProgressLatch = new CountDownLatch(1);
-        TaskId taskId = taskManager.submit(() -> {
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> {
             inProgressLatch.countDown();
             waitForResult();
             return Task.Result.COMPLETED;
-        });
+        }));
 
         inProgressLatch.await();
 
@@ -140,17 +141,17 @@ class TasksRoutesTest {
             .body("", hasSize(1))
             .body("[0].status", is(TaskManager.Status.IN_PROGRESS.getValue()))
             .body("[0].taskId", is(taskId.asString()))
-            .body("[0].type", is(Task.UNKNOWN.asString()));
+            .body("[0].type", is(MemoryReferenceTask.TYPE.asString()));
     }
 
     @Test
     void listShouldReturnEmptyWhenNonMatchingStatusFilter() throws Exception {
         CountDownLatch inProgressLatch = new CountDownLatch(1);
-        taskManager.submit(() -> {
+        taskManager.submit(new MemoryReferenceTask(() -> {
             inProgressLatch.countDown();
             waitForResult();
             return Task.Result.COMPLETED;
-        });
+        }));
 
         inProgressLatch.await();
 
@@ -166,11 +167,11 @@ class TasksRoutesTest {
     @Test
     void getShouldReturnTaskDetails() throws Exception {
         CountDownLatch inProgressLatch = new CountDownLatch(1);
-        TaskId taskId = taskManager.submit(() -> {
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> {
             inProgressLatch.countDown();
             waitForResult();
             return Task.Result.COMPLETED;
-        });
+        }));
 
         inProgressLatch.await();
 
@@ -183,14 +184,14 @@ class TasksRoutesTest {
 
     @Test
     void getAwaitShouldAwaitTaskCompletion() {
-        TaskId taskId = taskManager.submit(() -> {
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> {
             try {
                 Thread.sleep(100);
             } catch (InterruptedException e) {
                 throw new RuntimeException(e);
             }
             return Task.Result.COMPLETED;
-        });
+        }));
 
         when()
             .get("/" + taskId.getValue() + "/await")
@@ -201,14 +202,14 @@ class TasksRoutesTest {
 
     @Test
     void getAwaitWithTimeoutShouldAwaitTaskCompletion() {
-        TaskId taskId = taskManager.submit(() -> {
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> {
             try {
                 Thread.sleep(1000);
             } catch (InterruptedException e) {
                 throw new RuntimeException(e);
             }
             return Task.Result.COMPLETED;
-        });
+        }));
 
         given()
             .queryParam("timeout", "2s")
@@ -221,7 +222,7 @@ class TasksRoutesTest {
 
     @Test
     void getAwaitWithInvalidTimeoutShouldReturnAnError() {
-        TaskId taskId = taskManager.submit(() -> Task.Result.COMPLETED);
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> Task.Result.COMPLETED));
 
         given()
             .queryParam("timeout", "-5")
@@ -235,7 +236,7 @@ class TasksRoutesTest {
 
     @Test
     void getAwaitWithATooBigTimeoutShouldReturnAnError() {
-        TaskId taskId = taskManager.submit(() -> Task.Result.COMPLETED);
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> Task.Result.COMPLETED));
 
         given()
             .queryParam("timeout", "5y")
@@ -249,14 +250,14 @@ class TasksRoutesTest {
 
     @Test
     void getAwaitWithAShorterTimeoutShouldReturnTimeout() {
-        TaskId taskId = taskManager.submit(() -> {
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> {
             try {
                 Thread.sleep(10000);
             } catch (InterruptedException e) {
                 throw new RuntimeException(e);
             }
             return Task.Result.COMPLETED;
-        });
+        }));
 
         given()
             .queryParam("timeout", "1")
@@ -279,9 +280,9 @@ class TasksRoutesTest {
 
     @Test
     void getAwaitShouldNotFailUponError() {
-        TaskId taskId = taskManager.submit(() -> {
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> {
             throw new RuntimeException();
-        });
+        }));
 
         when()
             .get("/" + taskId.getValue() + "/await")
@@ -292,14 +293,14 @@ class TasksRoutesTest {
 
     @Test
     void getAwaitShouldNotFailUponFutureError() {
-        TaskId taskId = taskManager.submit(() -> {
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> {
             try {
                 Thread.sleep(200);
             } catch (InterruptedException e) {
                 throw new RuntimeException(e);
             }
             throw new RuntimeException();
-        });
+        }));
 
         when()
             .get("/" + taskId.getValue() + "/await")
@@ -310,10 +311,10 @@ class TasksRoutesTest {
 
     @Test
     void deleteShouldReturnOk() {
-        TaskId taskId = taskManager.submit(() -> {
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> {
             waitForResult();
             return Task.Result.COMPLETED;
-        });
+        }));
 
         when()
             .delete("/" + taskId.getValue())
@@ -325,14 +326,14 @@ class TasksRoutesTest {
     void deleteShouldCancelMatchingTask() {
         CountDownLatch inProgressLatch = new CountDownLatch(1);
 
-        TaskId taskId = taskManager.submit(() -> {
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> {
             try {
                 inProgressLatch.await();
             } catch (InterruptedException e) {
                 //ignore
             }
             return Task.Result.COMPLETED;
-        });
+        }));
 
         with()
             .delete("/" + taskId.getValue());
diff --git a/server/task/task-api/src/test/java/org/apache/james/task/MemoryReferenceTask.java b/server/task/task-api/src/test/java/org/apache/james/task/MemoryReferenceTask.java
index 6ce1499..b00a53e 100644
--- a/server/task/task-api/src/test/java/org/apache/james/task/MemoryReferenceTask.java
+++ b/server/task/task-api/src/test/java/org/apache/james/task/MemoryReferenceTask.java
@@ -20,17 +20,25 @@ package org.apache.james.task;
 
 import java.util.Optional;
 
+import org.junit.jupiter.api.function.ThrowingSupplier;
+
 public class MemoryReferenceTask implements Task {
     public static final TaskType TYPE = TaskType.of("memory-reference-task");
-    private final Task task;
+    private final ThrowingSupplier<Result> task;
 
-    public MemoryReferenceTask(Task task) {
+    public MemoryReferenceTask(ThrowingSupplier<Result> task) {
         this.task = task;
     }
 
     @Override
     public Result run() throws InterruptedException {
-        return task.run();
+        try {
+            return task.get();
+        } catch (InterruptedException e) {
+            throw e;
+        } catch (Throwable throwable) {
+            throw new RuntimeException(throwable);
+        }
     }
 
     @Override
diff --git a/server/task/task-memory/src/test/java/org/apache/james/task/SerialTaskManagerWorkerTest.java b/server/task/task-memory/src/test/java/org/apache/james/task/SerialTaskManagerWorkerTest.java
index 522ed0c..a0779b4 100644
--- a/server/task/task-memory/src/test/java/org/apache/james/task/SerialTaskManagerWorkerTest.java
+++ b/server/task/task-memory/src/test/java/org/apache/james/task/SerialTaskManagerWorkerTest.java
@@ -94,11 +94,11 @@ class SerialTaskManagerWorkerTest {
         CountDownLatch latch = new CountDownLatch(1);
         CountDownLatch taskLaunched = new CountDownLatch(1);
 
-        Task inProgressTask = () -> {
+        Task inProgressTask = new MemoryReferenceTask(() -> {
             taskLaunched.countDown();
             await(latch);
             return Task.Result.COMPLETED;
-        };
+        });
 
         TaskWithId taskWithId = new TaskWithId(id, inProgressTask);
 
@@ -116,11 +116,11 @@ class SerialTaskManagerWorkerTest {
         AtomicInteger counter = new AtomicInteger(0);
         CountDownLatch latch = new CountDownLatch(1);
 
-        Task inProgressTask = () -> {
+        Task inProgressTask = new MemoryReferenceTask(() -> {
             await(latch);
             counter.incrementAndGet();
             return Task.Result.COMPLETED;
-        };
+        });
 
         TaskWithId taskWithId = new TaskWithId(id, inProgressTask);
 
diff --git a/server/task/task-memory/src/test/java/org/apache/james/task/TaskWithIdTest.java b/server/task/task-memory/src/test/java/org/apache/james/task/TaskWithIdTest.java
index a0a1ca0..40efa89 100644
--- a/server/task/task-memory/src/test/java/org/apache/james/task/TaskWithIdTest.java
+++ b/server/task/task-memory/src/test/java/org/apache/james/task/TaskWithIdTest.java
@@ -28,8 +28,8 @@ public class TaskWithIdTest {
     @Test
     public void twoTasksWithSameIdShouldBeEqual() {
         TaskId id = TaskId.generateTaskId();
-        Task task1 = () -> Task.Result.COMPLETED;
-        Task task2 = () -> Task.Result.COMPLETED;
+        Task task1 = new MemoryReferenceTask(() -> Task.Result.COMPLETED);
+        Task task2 = new MemoryReferenceTask(() -> Task.Result.COMPLETED);
         TaskWithId taskWithId1 = new TaskWithId(id, task1);
         TaskWithId taskWithId2 = new TaskWithId(id, task2);
         assertThat(taskWithId1).isEqualTo(taskWithId2);
@@ -39,7 +39,7 @@ public class TaskWithIdTest {
     public void sameTaskWithDifferentIdShouldNotBeEqual() {
         TaskId id1 = TaskId.generateTaskId();
         TaskId id2 = TaskId.generateTaskId();
-        Task task = () -> Task.Result.COMPLETED;
+        Task task = new MemoryReferenceTask(() -> Task.Result.COMPLETED);
         TaskWithId taskWithId1 = new TaskWithId(id1, task);
         TaskWithId taskWithId2 = new TaskWithId(id2, task);
         assertThat(taskWithId1).isNotEqualTo(taskWithId2);
diff --git a/server/task/task-memory/src/test/java/org/apache/james/task/eventsourcing/EventSourcingTaskManagerTest.java b/server/task/task-memory/src/test/java/org/apache/james/task/eventsourcing/EventSourcingTaskManagerTest.java
index 891c346..d3d9653 100644
--- a/server/task/task-memory/src/test/java/org/apache/james/task/eventsourcing/EventSourcingTaskManagerTest.java
+++ b/server/task/task-memory/src/test/java/org/apache/james/task/eventsourcing/EventSourcingTaskManagerTest.java
@@ -26,6 +26,7 @@ import org.apache.james.eventsourcing.eventstore.EventStore;
 import org.apache.james.eventsourcing.eventstore.memory.InMemoryEventStore;
 import org.apache.james.task.CountDownLatchExtension;
 import org.apache.james.task.Hostname;
+import org.apache.james.task.MemoryReferenceTask;
 import org.apache.james.task.MemoryWorkQueue;
 import org.apache.james.task.SerialTaskManagerWorker;
 import org.apache.james.task.Task;
@@ -75,7 +76,7 @@ class EventSourcingTaskManagerTest implements TaskManagerContract {
 
     @Test
     void createdTaskShouldKeepOriginHostname() {
-        TaskId taskId = taskManager.submit(() -> Task.Result.COMPLETED);
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> Task.Result.COMPLETED));
         TaskAggregateId aggregateId = new TaskAggregateId(taskId);
         assertThat(eventStore.getEventsOfAggregate(aggregateId).getEvents())
                 .filteredOn(event -> event instanceof Created)
@@ -85,7 +86,7 @@ class EventSourcingTaskManagerTest implements TaskManagerContract {
 
     @Test
     void startedTaskShouldKeepOriginHostname() {
-        TaskId taskId = taskManager.submit(() -> Task.Result.COMPLETED);
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> Task.Result.COMPLETED));
         TaskAggregateId aggregateId = new TaskAggregateId(taskId);
 
         CALMLY_AWAIT.untilAsserted(() ->
@@ -97,10 +98,10 @@ class EventSourcingTaskManagerTest implements TaskManagerContract {
 
     @Test
     void cancelRequestedTaskShouldKeepOriginHostname() {
-        TaskId taskId = taskManager.submit(() -> {
+        TaskId taskId = taskManager.submit(new MemoryReferenceTask(() -> {
             Thread.sleep(100);
             return Task.Result.COMPLETED;
-        });
+        }));
         taskManager.cancel(taskId);
 
         TaskAggregateId aggregateId = new TaskAggregateId(taskId);


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[james-project] 01/04: JAMES-2813 add task type for CleanupTasksPerformer

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 4a377d481c110426ae9ded486d041ba3d318fcdd
Author: Rémi KOWALSKI <rk...@linagora.com>
AuthorDate: Wed Oct 2 10:04:27 2019 +0200

    JAMES-2813 add task type for CleanupTasksPerformer
---
 .../src/main/java/org/apache/james/CleanupTasksPerformer.java        | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/CleanupTasksPerformer.java b/server/container/guice/guice-common/src/main/java/org/apache/james/CleanupTasksPerformer.java
index 9bcb45b..1908899 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/CleanupTasksPerformer.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/CleanupTasksPerformer.java
@@ -25,6 +25,7 @@ import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 
 import org.apache.james.task.Task;
+import org.apache.james.task.TaskType;
 import org.apache.james.util.Runnables;
 
 import com.github.fge.lambdas.Throwing;
@@ -33,7 +34,9 @@ import reactor.core.publisher.Flux;
 public class CleanupTasksPerformer {
 
     public interface CleanupTask extends Task {
-
+        default TaskType type() {
+            return TaskType.of("cleanup_task");
+        }
     }
 
     private final Set<CleanupTask> cleanupTasks;


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[james-project] 04/04: JAMES-2813 remove default type in Task

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 4dd45cd6800e7b506dfbbfa1be12d80fa59f45fe
Author: Rémi KOWALSKI <rk...@linagora.com>
AuthorDate: Wed Oct 2 10:06:57 2019 +0200

    JAMES-2813 remove default type in Task
---
 server/task/task-api/src/main/java/org/apache/james/task/Task.java | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/server/task/task-api/src/main/java/org/apache/james/task/Task.java b/server/task/task-api/src/main/java/org/apache/james/task/Task.java
index c66e40c..ac8c211 100644
--- a/server/task/task-api/src/main/java/org/apache/james/task/Task.java
+++ b/server/task/task-api/src/main/java/org/apache/james/task/Task.java
@@ -92,10 +92,7 @@ public interface Task {
      */
     Result run() throws InterruptedException;
 
-
-    default TaskType type() {
-        return UNKNOWN;
-    }
+    TaskType type();
 
     default Optional<TaskExecutionDetails.AdditionalInformation> details() {
         return Optional.empty();


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org