diff --git a/helenus-core.iml b/helenus-core.iml
index 2578277..d38133a 100644
--- a/helenus-core.iml
+++ b/helenus-core.iml
@@ -36,9 +36,6 @@
-
-
-
diff --git a/pom.xml b/pom.xml
index 0011e00..8b502a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -154,19 +154,7 @@
20.0
-
-
- io.zipkin.java
- zipkin
- 1.29.2
-
-
-
- io.zipkin.brave
- brave
- 4.0.6
-
-
+
io.dropwizard.metrics
metrics-core
diff --git a/src/main/java/net/helenus/core/AbstractSessionOperations.java b/src/main/java/net/helenus/core/AbstractSessionOperations.java
index 65d98f8..a5603e6 100644
--- a/src/main/java/net/helenus/core/AbstractSessionOperations.java
+++ b/src/main/java/net/helenus/core/AbstractSessionOperations.java
@@ -15,7 +15,6 @@
*/
package net.helenus.core;
-import brave.Tracer;
import com.codahale.metrics.MetricRegistry;
import com.datastax.driver.core.*;
import com.google.common.base.Stopwatch;
@@ -110,10 +109,6 @@ public abstract class AbstractSessionOperations {
}
}
- public Tracer getZipkinTracer() {
- return null;
- }
-
public MetricRegistry getMetricRegistry() {
return null;
}
diff --git a/src/main/java/net/helenus/core/AbstractUnitOfWork.java b/src/main/java/net/helenus/core/AbstractUnitOfWork.java
deleted file mode 100644
index 51ec9cc..0000000
--- a/src/main/java/net/helenus/core/AbstractUnitOfWork.java
+++ /dev/null
@@ -1,570 +0,0 @@
-/*
- * Copyright (C) 2015 The Helenus Authors
- *
- * Licensed 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 net.helenus.core;
-
-import static net.helenus.core.HelenusSession.deleted;
-
-import com.google.common.base.Stopwatch;
-import com.google.common.collect.HashBasedTable;
-import com.google.common.collect.Table;
-import com.google.common.collect.TreeTraverser;
-import java.io.Serializable;
-import java.util.*;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.stream.Collectors;
-import javax.cache.Cache;
-import javax.cache.CacheManager;
-import javax.cache.integration.CacheLoader;
-import javax.cache.integration.CacheLoaderException;
-import net.helenus.core.cache.CacheUtil;
-import net.helenus.core.cache.Facet;
-import net.helenus.core.cache.MapCache;
-import net.helenus.core.operation.AbstractOperation;
-import net.helenus.core.operation.BatchOperation;
-import net.helenus.mapping.MappingUtil;
-import net.helenus.support.Either;
-import net.helenus.support.HelenusException;
-import org.apache.commons.lang3.SerializationUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** Encapsulates the concept of a "transaction" as a unit-of-work. */
-public abstract class AbstractUnitOfWork
- implements UnitOfWork, AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(AbstractUnitOfWork.class);
-
- private final List> nested = new ArrayList<>();
- private final HelenusSession session;
- public final AbstractUnitOfWork parent;
- private final Table>> cache = HashBasedTable.create();
- private final MapCache statementCache;
- protected String purpose;
- protected List nestedPurposes = new ArrayList();
- protected String info;
- protected int cacheHits = 0;
- protected int cacheMisses = 0;
- protected int databaseLookups = 0;
- protected Stopwatch elapsedTime;
- protected Map databaseTime = new HashMap<>();
- protected double cacheLookupTimeMSecs = 0.0;
- private List commitThunks = new ArrayList();
- private List abortThunks = new ArrayList();
- private List> asyncOperationFutures = new ArrayList>();
- private boolean aborted = false;
- private boolean committed = false;
- private long committedAt = 0L;
- private BatchOperation batch;
-
- protected AbstractUnitOfWork(HelenusSession session, AbstractUnitOfWork parent) {
- Objects.requireNonNull(session, "containing session cannot be null");
-
- this.session = session;
- this.parent = parent;
- CacheLoader cacheLoader = null;
- if (parent != null) {
- cacheLoader =
- new CacheLoader() {
-
- Cache cache = parent.getCache();
-
- @Override
- public Object load(String key) throws CacheLoaderException {
- return cache.get(key);
- }
-
- @Override
- public Map loadAll(Iterable extends String> keys)
- throws CacheLoaderException {
- Map kvp = new HashMap();
- for (String key : keys) {
- kvp.put(key, cache.get(key));
- }
- return kvp;
- }
- };
- }
- this.statementCache =
- new MapCache(null, "UOW(" + hashCode() + ")", cacheLoader, true);
- }
-
- @Override
- public void addDatabaseTime(String name, Stopwatch amount) {
- Double time = databaseTime.get(name);
- if (time == null) {
- databaseTime.put(name, (double) amount.elapsed(TimeUnit.MICROSECONDS));
- } else {
- databaseTime.put(name, time + amount.elapsed(TimeUnit.MICROSECONDS));
- }
- }
-
- @Override
- public void addCacheLookupTime(Stopwatch amount) {
- cacheLookupTimeMSecs += amount.elapsed(TimeUnit.MICROSECONDS);
- }
-
- @Override
- public void addNestedUnitOfWork(UnitOfWork uow) {
- synchronized (nested) {
- nested.add((AbstractUnitOfWork) uow);
- }
- }
-
- @Override
- public synchronized UnitOfWork begin() {
- elapsedTime = Stopwatch.createStarted();
- // log.record(txn::start)
- return this;
- }
-
- @Override
- public String getPurpose() {
- return purpose;
- }
-
- @Override
- public UnitOfWork setPurpose(String purpose) {
- this.purpose = purpose;
- return this;
- }
-
- @Override
- public void addFuture(CompletableFuture> future) {
- asyncOperationFutures.add(future);
- }
-
- @Override
- public void setInfo(String info) {
- this.info = info;
- }
-
- @Override
- public void recordCacheAndDatabaseOperationCount(int cache, int ops) {
- if (cache > 0) {
- cacheHits += cache;
- } else {
- cacheMisses += Math.abs(cache);
- }
- if (ops > 0) {
- databaseLookups += ops;
- }
- }
-
- public String logTimers(String what) {
- double e = (double) elapsedTime.elapsed(TimeUnit.MICROSECONDS) / 1000.0;
- double d = 0.0;
- double c = cacheLookupTimeMSecs / 1000.0;
- double fc = (c / e) * 100.0;
- String database = "";
- if (databaseTime.size() > 0) {
- List dbt = new ArrayList<>(databaseTime.size());
- for (Map.Entry dt : databaseTime.entrySet()) {
- double t = dt.getValue() / 1000.0;
- d += t;
- dbt.add(String.format("%s took %,.3fms %,2.2f%%", dt.getKey(), t, (t / e) * 100.0));
- }
- double fd = (d / e) * 100.0;
- database =
- String.format(
- ", %d quer%s (%,.3fms %,2.2f%% - %s)",
- databaseLookups, (databaseLookups > 1) ? "ies" : "y", d, fd, String.join(", ", dbt));
- }
- String cache = "";
- if (cacheLookupTimeMSecs > 0) {
- int cacheLookups = cacheHits + cacheMisses;
- cache =
- String.format(
- " with %d cache lookup%s (%,.3fms %,2.2f%% - %,d hit, %,d miss)",
- cacheLookups, cacheLookups > 1 ? "s" : "", c, fc, cacheHits, cacheMisses);
- }
- String da = "";
- if (databaseTime.size() > 0 || cacheLookupTimeMSecs > 0) {
- double dat = d + c;
- double daf = (dat / e) * 100;
- da =
- String.format(
- " consuming %,.3fms for data access, or %,2.2f%% of total UOW time.", dat, daf);
- }
- String x = nestedPurposes.stream().distinct().collect(Collectors.joining(", "));
- String n =
- nested
- .stream()
- .map(uow -> String.valueOf(uow.hashCode()))
- .collect(Collectors.joining(", "));
- String s =
- String.format(
- Locale.US,
- "UOW(%s%s) %s in %,.3fms%s%s%s%s%s%s",
- hashCode(),
- (nested.size() > 0 ? ", [" + n + "]" : ""),
- what,
- e,
- cache,
- database,
- da,
- (purpose == null ? "" : " " + purpose),
- (nestedPurposes.isEmpty()) ? "" : ", " + x,
- (info == null) ? "" : " " + info);
- return s;
- }
-
- private void applyPostCommitFunctions(String what, List thunks) {
- if (!thunks.isEmpty()) {
- for (CommitThunk f : thunks) {
- f.apply();
- }
- }
- }
-
- @Override
- public Optional