Another spot I missed allowing null UOW in {a}sync().

This commit is contained in:
Greg Burd 2017-09-14 13:16:06 -04:00
parent 97f74776d5
commit 895921c598
3 changed files with 6 additions and 6 deletions

View file

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

View file

@ -52,7 +52,7 @@ public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>>
} }
public E sync(UnitOfWork uow) { public 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(); final Timer.Context context = requestLatency.time();
try { try {
@ -69,7 +69,7 @@ public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>>
} }
public CompletableFuture<E> async(UnitOfWork uow) { public CompletableFuture<E> async(UnitOfWork uow) {
Objects.requireNonNull(uow, "Unit of Work should not be null."); if (uow == null) return async();
return CompletableFuture.<E>supplyAsync(() -> sync(uow)); return CompletableFuture.<E>supplyAsync(() -> sync(uow));
} }

View file

@ -26,9 +26,9 @@ public abstract class Operation<E> {
Operation(AbstractSessionOperations sessionOperations) { Operation(AbstractSessionOperations sessionOperations) {
this.sessionOps = sessionOperations; this.sessionOps = sessionOperations;
MetricRegistry metrics = sessionOperations.getMetricRegistry(); MetricRegistry metrics = sessionOperations.getMetricRegistry();
this.uowCacheHits = metrics.meter("helenus.UOW-cache-hits"); this.uowCacheHits = metrics.meter("net.helenus.UOW-cache-hits");
this.uowCacheMiss = metrics.meter("helenus.UOW-cache-miss"); this.uowCacheMiss = metrics.meter("net.helenus.UOW-cache-miss");
this.requestLatency = metrics.timer("helenus.request-latency"); this.requestLatency = metrics.timer("net.helenus.request-latency");
} }
public ResultSet execute(AbstractSessionOperations session, UnitOfWork uow, TraceContext traceContext, boolean showValues, boolean cached) { public ResultSet execute(AbstractSessionOperations session, UnitOfWork uow, TraceContext traceContext, boolean showValues, boolean cached) {