This is an automated email from the ASF dual-hosted git repository. matthieu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 739f5a15793a65765d1319e1254a5e2303633305 Author: Rémi KOWALSKI <rkowal...@linagora.com> AuthorDate: Mon Dec 9 14:10:16 2019 +0100 JAMES-3009 convert to scala event-sourcing-pojo --- .../james/eventsourcing/CommandDispatcher.java | 2 + .../apache/james/eventsourcing/CommandHandler.java | 2 + .../org/apache/james/eventsourcing/EventBus.java | 1 + .../james/eventsourcing/EventSourcingSystem.java | 2 + .../org/apache/james/eventsourcing/Subscriber.java | 2 + .../eventsourcing/DataCollectorSubscriber.java | 1 + .../eventsourcing/EventSourcingSystemTest.java | 3 + event-sourcing/event-sourcing-pojo/pom.xml | 16 ++++ .../org/apache/james/eventsourcing/EventId.java | 86 ---------------------- .../apache/james/eventsourcing/AggregateId.scala} | 13 ++-- .../org/apache/james/eventsourcing/Command.scala} | 10 +-- .../org/apache/james/eventsourcing/Event.scala | 23 ++++-- .../org/apache/james/eventsourcing/EventId.scala} | 39 +++++----- .../apache/james/eventsourcing/EventIdTest.java | 5 +- .../james/eventsourcing/TestAggregateId.java | 3 +- .../org/apache/james/eventsourcing/TestEvent.java | 2 + .../james/eventsourcing/eventstore/History.scala | 8 +- .../eventstore/memory/InMemoryEventStore.scala | 8 +- .../distributed/RabbitMQWorkQueueSupplier.scala | 1 - .../eventsourcing/EventSourcingTaskManager.scala | 3 +- .../eventsourcing/ScalaEventSourcingSystem.scala | 3 - .../TaskExecutionDetailsProjection.scala | 1 - .../task/eventsourcing/TerminationSubscriber.scala | 11 ++- .../task/eventsourcing/WorkQueueSupplier.scala | 1 - .../task/eventsourcing/WorkerStatusListener.scala | 1 - .../TerminationSubscriberContract.java | 2 +- 26 files changed, 98 insertions(+), 151 deletions(-) diff --git a/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/CommandDispatcher.java b/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/CommandDispatcher.java index ba22d04..9efc3c0 100644 --- a/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/CommandDispatcher.java +++ b/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/CommandDispatcher.java @@ -31,6 +31,8 @@ import javax.inject.Inject; import org.apache.james.eventsourcing.eventstore.EventStoreFailedException; import com.github.steveash.guavate.Guavate; +import org.apache.james.eventsourcing.Command; +import org.apache.james.eventsourcing.Event; public class CommandDispatcher { diff --git a/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/CommandHandler.java b/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/CommandHandler.java index 6b8aacf..cb51ae9 100644 --- a/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/CommandHandler.java +++ b/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/CommandHandler.java @@ -21,6 +21,8 @@ package org.apache.james.eventsourcing; import java.util.List; +import org.apache.james.eventsourcing.Event; + public interface CommandHandler<C> { Class<C> handledClass(); diff --git a/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/EventBus.java b/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/EventBus.java index 22b817f..5d17bd2 100644 --- a/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/EventBus.java +++ b/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/EventBus.java @@ -31,6 +31,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.ImmutableSet; +import org.apache.james.eventsourcing.Event; public class EventBus { diff --git a/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/EventSourcingSystem.java b/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/EventSourcingSystem.java index e077fe6..53c7f2a 100644 --- a/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/EventSourcingSystem.java +++ b/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/EventSourcingSystem.java @@ -23,6 +23,8 @@ import java.util.Set; import org.apache.james.eventsourcing.eventstore.EventStore; +import org.apache.james.eventsourcing.Command; + public class EventSourcingSystem { private final CommandDispatcher commandDispatcher; diff --git a/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/Subscriber.java b/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/Subscriber.java index 42a804d..57a9f35 100644 --- a/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/Subscriber.java +++ b/event-sourcing/event-sourcing-core/src/main/java/org/apache/james/eventsourcing/Subscriber.java @@ -19,6 +19,8 @@ package org.apache.james.eventsourcing; +import org.apache.james.eventsourcing.Event; + public interface Subscriber { void handle(Event event); } diff --git a/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/DataCollectorSubscriber.java b/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/DataCollectorSubscriber.java index 85fccd1..d1f65e6 100644 --- a/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/DataCollectorSubscriber.java +++ b/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/DataCollectorSubscriber.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.List; import com.google.common.collect.ImmutableList; +import org.apache.james.eventsourcing.Event; public class DataCollectorSubscriber implements Subscriber { diff --git a/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/EventSourcingSystemTest.java b/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/EventSourcingSystemTest.java index 3fe8297..6dbe68a 100644 --- a/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/EventSourcingSystemTest.java +++ b/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/EventSourcingSystemTest.java @@ -37,6 +37,9 @@ import com.github.steveash.guavate.Guavate; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; +import org.apache.james.eventsourcing.Command; +import org.apache.james.eventsourcing.Event; +import org.apache.james.eventsourcing.EventId; import scala.jdk.javaapi.CollectionConverters; public interface EventSourcingSystemTest { diff --git a/event-sourcing/event-sourcing-pojo/pom.xml b/event-sourcing/event-sourcing-pojo/pom.xml index 9740849..dcf6484 100644 --- a/event-sourcing/event-sourcing-pojo/pom.xml +++ b/event-sourcing/event-sourcing-pojo/pom.xml @@ -41,5 +41,21 @@ <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> </dependency> + <dependency> + <groupId>org.scala-lang</groupId> + <artifactId>scala-library</artifactId> + </dependency> + <dependency> + <groupId>org.scala-lang.modules</groupId> + <artifactId>scala-java8-compat_${scala.base}</artifactId> + </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>net.alchim31.maven</groupId> + <artifactId>scala-maven-plugin</artifactId> + </plugin> + </plugins> + </build> </project> diff --git a/event-sourcing/event-sourcing-pojo/src/main/java/org/apache/james/eventsourcing/EventId.java b/event-sourcing/event-sourcing-pojo/src/main/java/org/apache/james/eventsourcing/EventId.java deleted file mode 100644 index cb5bd1e..0000000 --- a/event-sourcing/event-sourcing-pojo/src/main/java/org/apache/james/eventsourcing/EventId.java +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.eventsourcing; - -import java.util.Objects; -import java.util.Optional; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Preconditions; - -public class EventId implements Comparable<EventId> { - - public static EventId fromSerialized(int value) { - return new EventId(value); - } - - public static EventId first() { - return new EventId(0); - } - - private final int value; - - private EventId(int value) { - Preconditions.checkArgument(value >= 0, "EventId can not be negative"); - this.value = value; - } - - public EventId next() { - return new EventId(value + 1); - } - - public Optional<EventId> previous() { - if (value > 0) { - return Optional.of(new EventId(value - 1)); - } - return Optional.empty(); - } - - @Override - public int compareTo(EventId o) { - return Long.compare(value, o.value); - } - - @Override - public final boolean equals(Object o) { - if (o instanceof EventId) { - EventId eventId = (EventId) o; - - return Objects.equals(this.value, eventId.value); - } - return false; - } - - @Override - public final int hashCode() { - return Objects.hash(value); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("value", value) - .toString(); - } - - public int serialize() { - return value; - } -} diff --git a/event-sourcing/event-sourcing-pojo/src/main/java/org/apache/james/eventsourcing/AggregateId.java b/event-sourcing/event-sourcing-pojo/src/main/scala/org/apache/james/eventsourcing/AggregateId.scala similarity index 81% rename from event-sourcing/event-sourcing-pojo/src/main/java/org/apache/james/eventsourcing/AggregateId.java rename to event-sourcing/event-sourcing-pojo/src/main/scala/org/apache/james/eventsourcing/AggregateId.scala index 18c6224..77eb679 100644 --- a/event-sourcing/event-sourcing-pojo/src/main/java/org/apache/james/eventsourcing/AggregateId.java +++ b/event-sourcing/event-sourcing-pojo/src/main/scala/org/apache/james/eventsourcing/AggregateId.scala @@ -7,7 +7,7 @@ * "License"); you may not use this file except in compliance * * with the License. You may obtain a copy of the License at * * * - * http://www.apache.org/licenses/LICENSE-2.0 * + * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, * * software distributed under the License is distributed on an * @@ -15,10 +15,9 @@ * KIND, either express or implied. See the License for the * * specific language governing permissions and limitations * * under the License. * - ****************************************************************/ + * ***************************************************************/ +package org.apache.james.eventsourcing -package org.apache.james.eventsourcing; - -public interface AggregateId { - String asAggregateKey(); -} +trait AggregateId { + def asAggregateKey : String +} \ No newline at end of file diff --git a/event-sourcing/event-sourcing-pojo/src/main/java/org/apache/james/eventsourcing/Command.java b/event-sourcing/event-sourcing-pojo/src/main/scala/org/apache/james/eventsourcing/Command.scala similarity index 84% rename from event-sourcing/event-sourcing-pojo/src/main/java/org/apache/james/eventsourcing/Command.java rename to event-sourcing/event-sourcing-pojo/src/main/scala/org/apache/james/eventsourcing/Command.scala index dad8332..4976e1a 100644 --- a/event-sourcing/event-sourcing-pojo/src/main/java/org/apache/james/eventsourcing/Command.java +++ b/event-sourcing/event-sourcing-pojo/src/main/scala/org/apache/james/eventsourcing/Command.scala @@ -7,7 +7,7 @@ * "License"); you may not use this file except in compliance * * with the License. You may obtain a copy of the License at * * * - * http://www.apache.org/licenses/LICENSE-2.0 * + * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, * * software distributed under the License is distributed on an * @@ -15,9 +15,7 @@ * KIND, either express or implied. See the License for the * * specific language governing permissions and limitations * * under the License. * - ****************************************************************/ + * ***************************************************************/ +package org.apache.james.eventsourcing -package org.apache.james.eventsourcing; - -public interface Command { -} +trait Command {} \ No newline at end of file diff --git a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/WorkQueueSupplier.scala b/event-sourcing/event-sourcing-pojo/src/main/scala/org/apache/james/eventsourcing/Event.scala similarity index 73% copy from server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/WorkQueueSupplier.scala copy to event-sourcing/event-sourcing-pojo/src/main/scala/org/apache/james/eventsourcing/Event.scala index 0265359..c530413 100644 --- a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/WorkQueueSupplier.scala +++ b/event-sourcing/event-sourcing-pojo/src/main/scala/org/apache/james/eventsourcing/Event.scala @@ -16,12 +16,21 @@ * specific language governing permissions and limitations * * under the License. * * ***************************************************************/ -package org.apache.james.task.eventsourcing +package org.apache.james.eventsourcing -import org.apache.james.eventsourcing.EventSourcingSystem -import org.apache.james.task.WorkQueue - -@FunctionalInterface -trait WorkQueueSupplier { - def apply(eventSourcingSystem: EventSourcingSystem): WorkQueue +object Event { + def belongsToSameAggregate(events: List[_ <: Event]) = events + .view + .map(event => event.getAggregateId) + .distinct + .take(2) + .size == 1 } + +trait Event extends Comparable[Event] { + def eventId: EventId + + def getAggregateId: AggregateId + + override def compareTo(o: Event): Int = eventId.compareTo(o.eventId) +} \ No newline at end of file diff --git a/event-sourcing/event-sourcing-pojo/src/main/java/org/apache/james/eventsourcing/Event.java b/event-sourcing/event-sourcing-pojo/src/main/scala/org/apache/james/eventsourcing/EventId.scala similarity index 55% rename from event-sourcing/event-sourcing-pojo/src/main/java/org/apache/james/eventsourcing/Event.java rename to event-sourcing/event-sourcing-pojo/src/main/scala/org/apache/james/eventsourcing/EventId.scala index 2b31374..077aae1 100644 --- a/event-sourcing/event-sourcing-pojo/src/main/java/org/apache/james/eventsourcing/Event.java +++ b/event-sourcing/event-sourcing-pojo/src/main/scala/org/apache/james/eventsourcing/EventId.scala @@ -1,4 +1,4 @@ -/**************************************************************** +/** ************************************************************** * Licensed to the Apache Software Foundation (ASF) under one * * or more contributor license agreements. See the NOTICE file * * distributed with this work for additional information * @@ -7,7 +7,7 @@ * "License"); you may not use this file except in compliance * * with the License. You may obtain a copy of the License at * * * - * http://www.apache.org/licenses/LICENSE-2.0 * + * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, * * software distributed under the License is distributed on an * @@ -15,29 +15,28 @@ * KIND, either express or implied. See the License for the * * specific language governing permissions and limitations * * under the License. * - ****************************************************************/ + * ***************************************************************/ +package org.apache.james.eventsourcing -package org.apache.james.eventsourcing; +import com.google.common.base.Preconditions -import java.util.List; +object EventId { + def fromSerialized(value: Int) = new EventId(value) -public interface Event extends Comparable<Event> { + def first = new EventId(0) +} - static boolean belongsToSameAggregate(List<? extends Event> events) { - return events.stream() - .map(Event::getAggregateId) - .distinct() - .limit(2) - .count() == 1; - } +final case class EventId private(value: Int) extends Comparable[EventId] { + Preconditions.checkArgument(value >= 0, "EventId can not be negative".asInstanceOf[Object]) - EventId eventId(); + def next = new EventId(value + 1) - AggregateId getAggregateId(); + def previous: Option[EventId] = { + if (value > 0) return Some(new EventId(value - 1)) + None + } - @Override - default int compareTo(Event o) { - return eventId().compareTo(o.eventId()); - } + override def compareTo(o: EventId): Int = value.compareTo(o.value) -} + def serialize: Int = value +} \ No newline at end of file diff --git a/event-sourcing/event-sourcing-pojo/src/test/java/org/apache/james/eventsourcing/EventIdTest.java b/event-sourcing/event-sourcing-pojo/src/test/java/org/apache/james/eventsourcing/EventIdTest.java index ea566f8..e411e39 100644 --- a/event-sourcing/event-sourcing-pojo/src/test/java/org/apache/james/eventsourcing/EventIdTest.java +++ b/event-sourcing/event-sourcing-pojo/src/test/java/org/apache/james/eventsourcing/EventIdTest.java @@ -24,6 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat; import org.junit.jupiter.api.Test; import nl.jqno.equalsverifier.EqualsVerifier; +import scala.jdk.javaapi.OptionConverters; class EventIdTest { @@ -41,7 +42,7 @@ class EventIdTest { @Test void previousShouldReturnEmptyWhenBeforeFirst() { - assertThat(EventId.first().previous()) + assertThat(OptionConverters.toJava(EventId.first().previous())) .isEmpty(); } @@ -65,7 +66,7 @@ class EventIdTest { @Test void previousShouldRevertNext() { - assertThat(EventId.first().next().previous()) + assertThat(OptionConverters.toJava(EventId.first().next().previous())) .contains(EventId.first()); } diff --git a/event-sourcing/event-sourcing-pojo/src/test/java/org/apache/james/eventsourcing/TestAggregateId.java b/event-sourcing/event-sourcing-pojo/src/test/java/org/apache/james/eventsourcing/TestAggregateId.java index b3ae78c..2c53628 100644 --- a/event-sourcing/event-sourcing-pojo/src/test/java/org/apache/james/eventsourcing/TestAggregateId.java +++ b/event-sourcing/event-sourcing-pojo/src/test/java/org/apache/james/eventsourcing/TestAggregateId.java @@ -22,8 +22,9 @@ package org.apache.james.eventsourcing; import java.util.Objects; import com.google.common.base.MoreObjects; +import org.apache.james.eventsourcing.AggregateId; -public class TestAggregateId implements AggregateId { +public class TestAggregateId implements AggregateId { public static TestAggregateId testId(int id) { return new TestAggregateId(id); diff --git a/event-sourcing/event-sourcing-pojo/src/test/java/org/apache/james/eventsourcing/TestEvent.java b/event-sourcing/event-sourcing-pojo/src/test/java/org/apache/james/eventsourcing/TestEvent.java index c46f804..c65b96d 100644 --- a/event-sourcing/event-sourcing-pojo/src/test/java/org/apache/james/eventsourcing/TestEvent.java +++ b/event-sourcing/event-sourcing-pojo/src/test/java/org/apache/james/eventsourcing/TestEvent.java @@ -23,6 +23,8 @@ import java.util.Comparator; import java.util.Objects; import com.google.common.base.MoreObjects; +import org.apache.james.eventsourcing.Event; +import org.apache.james.eventsourcing.EventId; public class TestEvent implements Event { private final EventId id; diff --git a/event-sourcing/event-store-api/src/main/scala/org/apache/james/eventsourcing/eventstore/History.scala b/event-sourcing/event-store-api/src/main/scala/org/apache/james/eventsourcing/eventstore/History.scala index 05c8fb2..29d0132 100644 --- a/event-sourcing/event-store-api/src/main/scala/org/apache/james/eventsourcing/eventstore/History.scala +++ b/event-sourcing/event-store-api/src/main/scala/org/apache/james/eventsourcing/eventstore/History.scala @@ -33,15 +33,17 @@ object History { def of(events: Event*): History = of(events.toList) } -case class History private(events: List[Event]) { +final case class History private(events: List[Event]) { if (hasEventIdDuplicates(events)) throw EventStoreFailedException("Event History contains duplicated EventId") private def hasEventIdDuplicates(events: List[Event]) = { - val eventIdsNumber = events.map(event => event.eventId()).toSet.size + val eventIdsNumber = events.map(event => event.eventId).toSet.size eventIdsNumber != events.size } - def getVersion: Option[EventId] = events.map(event => event.eventId()).maxOption + def getVersion: Option[EventId] = events + .map(event => event.eventId) + .maxOption def getEvents = events diff --git a/event-sourcing/event-store-memory/src/main/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStore.scala b/event-sourcing/event-store-memory/src/main/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStore.scala index 155d90b..b689e0d 100644 --- a/event-sourcing/event-store-memory/src/main/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStore.scala +++ b/event-sourcing/event-store-memory/src/main/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStore.scala @@ -28,19 +28,19 @@ import org.apache.james.eventsourcing.{AggregateId, Event} import scala.jdk.CollectionConverters._ class InMemoryEventStore() extends EventStore { - private val storeRef: AtomicReference[Map[AggregateId, History]] = new AtomicReference(Map().withDefault(_ => History.empty())) + private val storeRef: AtomicReference[Map[AggregateId, History]] = new AtomicReference(Map().withDefault(_ => History.empty)) - override def appendAll(events: util.List[Event]): Unit = if (!events.isEmpty) appendAll(events.asScala.toSeq) + override def appendAll(events: List[Event]): Unit = if (events.nonEmpty) doAppendAll(events) override def getEventsOfAggregate(aggregateId: AggregateId): History = { Preconditions.checkNotNull(aggregateId) storeRef.get()(aggregateId) } - def appendAll(events: Seq[Event]): Unit = { + private def doAppendAll(events: Seq[Event]): Unit = { val aggregateId: AggregateId = getAggregateId(events) storeRef.updateAndGet(store => { - val updatedHistory = History.of((store(aggregateId).getEvents.asScala.toSeq ++ events).asJava) + val updatedHistory = History.of(store(aggregateId).getEvents ++ events) store.updated(aggregateId, updatedHistory) }) } diff --git a/server/task/task-distributed/src/main/scala/org/apache/james/task/eventsourcing/distributed/RabbitMQWorkQueueSupplier.scala b/server/task/task-distributed/src/main/scala/org/apache/james/task/eventsourcing/distributed/RabbitMQWorkQueueSupplier.scala index 7feed07..ee82bcb 100644 --- a/server/task/task-distributed/src/main/scala/org/apache/james/task/eventsourcing/distributed/RabbitMQWorkQueueSupplier.scala +++ b/server/task/task-distributed/src/main/scala/org/apache/james/task/eventsourcing/distributed/RabbitMQWorkQueueSupplier.scala @@ -23,7 +23,6 @@ import java.time.Duration import com.google.common.annotations.VisibleForTesting import javax.inject.Inject import org.apache.james.backends.rabbitmq.ReactorRabbitMQChannelPool -import org.apache.james.eventsourcing.EventSourcingSystem import org.apache.james.server.task.json.JsonTaskSerializer import org.apache.james.task.SerialTaskManagerWorker import org.apache.james.task.eventsourcing.{WorkQueueSupplier, WorkerStatusListener} diff --git a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/EventSourcingTaskManager.scala b/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/EventSourcingTaskManager.scala index 025d9ef..9d8eaaa 100644 --- a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/EventSourcingTaskManager.scala +++ b/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/EventSourcingTaskManager.scala @@ -26,10 +26,11 @@ import com.google.common.annotations.VisibleForTesting import javax.annotation.PreDestroy import javax.inject.Inject import org.apache.james.eventsourcing.eventstore.{EventStore, History} -import org.apache.james.eventsourcing.{AggregateId, Subscriber} +import org.apache.james.eventsourcing.Subscriber import org.apache.james.lifecycle.api.Startable import org.apache.james.task.TaskManager.ReachedTimeoutException import org.apache.james.task._ +import eventsourcing.AggregateId import org.apache.james.task.eventsourcing.TaskCommand._ import reactor.core.publisher.{Flux, Mono} import reactor.core.scheduler.Schedulers diff --git a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/ScalaEventSourcingSystem.scala b/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/ScalaEventSourcingSystem.scala index 2271854..14665c1 100644 --- a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/ScalaEventSourcingSystem.scala +++ b/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/ScalaEventSourcingSystem.scala @@ -18,9 +18,6 @@ * ***************************************************************/ package org.apache.james.task.eventsourcing -import org.apache.james.eventsourcing.eventstore.EventStore -import org.apache.james.eventsourcing.{CommandHandler, EventSourcingSystem, Subscriber} - object ScalaEventSourcingSystem { import scala.jdk.CollectionConverters._ def apply(handlers: Set[CommandHandler[_]], subscribers: Set[Subscriber], eventStore: EventStore): EventSourcingSystem = diff --git a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/TaskExecutionDetailsProjection.scala b/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/TaskExecutionDetailsProjection.scala index 2986410..0791a10 100644 --- a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/TaskExecutionDetailsProjection.scala +++ b/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/TaskExecutionDetailsProjection.scala @@ -20,7 +20,6 @@ package org.apache.james.task.eventsourcing import java.util.concurrent.ConcurrentHashMap -import org.apache.james.eventsourcing.Subscriber import org.apache.james.task.{Hostname, TaskExecutionDetails, TaskId} import scala.compat.java8.OptionConverters._ diff --git a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/TerminationSubscriber.scala b/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/TerminationSubscriber.scala index b0c705b..7aef9b1 100644 --- a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/TerminationSubscriber.scala +++ b/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/TerminationSubscriber.scala @@ -1,4 +1,4 @@ -/** ************************************************************** + /*************************************************************** * Licensed to the Apache Software Foundation (ASF) under one * * or more contributor license agreements. See the NOTICE file * * distributed with this work for additional information * @@ -6,22 +6,21 @@ * to you under the Apache License, Version 2.0 (the * * "License"); you may not use this file except in compliance * * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * * Unless required by applicable law or agreed to in writing, * * software distributed under the License is distributed on an * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * * KIND, either express or implied. See the License for the * * specific language governing permissions and limitations * * under the License. * - * ***************************************************************/ + ****************************************************************/ package org.apache.james.task.eventsourcing import org.apache.james.eventsourcing.{Event, Subscriber} import org.reactivestreams.Publisher - import reactor.core.publisher.DirectProcessor trait TerminationSubscriber extends Subscriber { diff --git a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/WorkQueueSupplier.scala b/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/WorkQueueSupplier.scala index 0265359..c8ba092 100644 --- a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/WorkQueueSupplier.scala +++ b/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/WorkQueueSupplier.scala @@ -18,7 +18,6 @@ * ***************************************************************/ package org.apache.james.task.eventsourcing -import org.apache.james.eventsourcing.EventSourcingSystem import org.apache.james.task.WorkQueue @FunctionalInterface diff --git a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/WorkerStatusListener.scala b/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/WorkerStatusListener.scala index aa93d82..5324514 100644 --- a/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/WorkerStatusListener.scala +++ b/server/task/task-memory/src/main/scala/org/apache/james/task/eventsourcing/WorkerStatusListener.scala @@ -22,7 +22,6 @@ package org.apache.james.task.eventsourcing import java.util.Optional import com.google.common.base.Throwables -import org.apache.james.eventsourcing.EventSourcingSystem import org.apache.james.task.Task.Result import org.apache.james.task.eventsourcing.TaskCommand._ import org.apache.james.task.{TaskExecutionDetails, TaskId, TaskManagerWorker} diff --git a/server/task/task-memory/src/test/java/org/apache/james/task/eventsourcing/TerminationSubscriberContract.java b/server/task/task-memory/src/test/java/org/apache/james/task/eventsourcing/TerminationSubscriberContract.java index b63c170..4fdda8b 100644 --- a/server/task/task-memory/src/test/java/org/apache/james/task/eventsourcing/TerminationSubscriberContract.java +++ b/server/task/task-memory/src/test/java/org/apache/james/task/eventsourcing/TerminationSubscriberContract.java @@ -29,7 +29,7 @@ import java.util.List; import org.apache.james.eventsourcing.Event; import org.apache.james.eventsourcing.EventId; -import org.apache.james.task.CompletedTask; + import org.apache.james.task.Hostname; import org.apache.james.task.Task; import org.apache.james.task.TaskId; --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org