Allow UOW to be null in {a}sync(UnitOfWork uow).

This commit is contained in:
Greg Burd 2017-09-14 09:34:12 -04:00
parent 8c165a689b
commit 97f74776d5
3 changed files with 5 additions and 7 deletions

View file

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.helenus</groupId>
<artifactId>helenus-core</artifactId>
<version>2.0.34-SNAPSHOT</version>
<version>2.0.35-SNAPSHOT</version>
<packaging>jar</packaging>
<name>helenus</name>

View file

@ -67,7 +67,7 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
}
public Optional<E> sync(UnitOfWork uow) {
Objects.requireNonNull(uow, "Unit of Work should not be null.");
if (uow == null) return sync();
final Timer.Context context = requestLatency.time();
try {
@ -112,8 +112,7 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
}
public CompletableFuture<Optional<E>> async(UnitOfWork uow) {
Objects.requireNonNull(uow, "Unit of Work should not be null.");
if (uow == null) return async();
return CompletableFuture.<Optional<E>>supplyAsync(() -> sync(uow));
}

View file

@ -72,7 +72,7 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
}
public Stream<E> sync(UnitOfWork uow) {
Objects.requireNonNull(uow, "Unit of Work should not be null.");
if (uow == null) return sync();
final Timer.Context context = requestLatency.time();
try {
@ -110,8 +110,7 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
}
public CompletableFuture<Stream<E>> async(UnitOfWork uow) {
Objects.requireNonNull(uow, "Unit of Work should not be null.");
if (uow == null) return async();
return CompletableFuture.<Stream<E>>supplyAsync(() -> sync(uow));
}