From 962145bf46c062d27aae9f6f79bfc63e0f76c6dd Mon Sep 17 00:00:00 2001 From: Greg Burd Date: Thu, 2 Nov 2017 15:08:58 -0400 Subject: [PATCH] Formatting. --- .../java/net/helenus/core/HelenusSession.java | 24 ++++++++-------- .../core/operation/InsertOperation.java | 7 +++-- .../net/helenus/core/operation/Operation.java | 28 +++++++++---------- .../core/operation/SelectOperation.java | 10 +++---- 4 files changed, 33 insertions(+), 36 deletions(-) diff --git a/src/main/java/net/helenus/core/HelenusSession.java b/src/main/java/net/helenus/core/HelenusSession.java index dc6e85d..37dee13 100644 --- a/src/main/java/net/helenus/core/HelenusSession.java +++ b/src/main/java/net/helenus/core/HelenusSession.java @@ -303,17 +303,15 @@ public class HelenusSession extends AbstractSessionOperations implements Closeab } private String extractClassNameFromStackFrame(String classNameOnStack) { - String name = null; - Matcher m = classNameRegex.matcher(classNameOnStack); - if (m.find()) { - name = (m.group(1) != null) ? - m.group(1) : - ((m.group(2) != null) ? m.group(2) : name); - } else { - name = classNameOnStack; - } - return name; - } + String name = null; + Matcher m = classNameRegex.matcher(classNameOnStack); + if (m.find()) { + name = (m.group(1) != null) ? m.group(1) : ((m.group(2) != null) ? m.group(2) : name); + } else { + name = classNameOnStack; + } + return name; + } public synchronized UnitOfWork begin(UnitOfWork parent) { try { @@ -328,11 +326,11 @@ public class HelenusSession extends AbstractSessionOperations implements Closeab String stackClassName = null; do { frame++; - stackClassName = extractClassNameFromStackFrame(trace[frame].getClassName()); + stackClassName = extractClassNameFromStackFrame(trace[frame].getClassName()); } while (!stackClassName.equals(targetClassName) && frame < trace.length); do { frame++; - stackClassName = extractClassNameFromStackFrame(trace[frame].getClassName()); + stackClassName = extractClassNameFromStackFrame(trace[frame].getClassName()); } while (stackClassName.equals(targetClassName) && frame < trace.length); if (frame < trace.length) { purpose = new StringBuilder().append(trace[frame].getClassName()).append(".") diff --git a/src/main/java/net/helenus/core/operation/InsertOperation.java b/src/main/java/net/helenus/core/operation/InsertOperation.java index 405e0c2..7252ee7 100644 --- a/src/main/java/net/helenus/core/operation/InsertOperation.java +++ b/src/main/java/net/helenus/core/operation/InsertOperation.java @@ -24,14 +24,15 @@ import com.datastax.driver.core.querybuilder.BuiltStatement; import com.datastax.driver.core.querybuilder.Insert; import com.datastax.driver.core.querybuilder.QueryBuilder; -import net.helenus.core.*; -import net.helenus.core.cache.CacheUtil; +import net.helenus.core.AbstractSessionOperations; +import net.helenus.core.Getter; +import net.helenus.core.Helenus; +import net.helenus.core.UnitOfWork; import net.helenus.core.cache.Facet; import net.helenus.core.cache.UnboundFacet; import net.helenus.core.reflect.DefaultPrimitiveTypes; import net.helenus.core.reflect.Drafted; import net.helenus.core.reflect.HelenusPropertyNode; -import net.helenus.mapping.ColumnType; import net.helenus.mapping.HelenusEntity; import net.helenus.mapping.HelenusProperty; import net.helenus.mapping.MappingUtil; diff --git a/src/main/java/net/helenus/core/operation/Operation.java b/src/main/java/net/helenus/core/operation/Operation.java index e0d18a0..02f1127 100644 --- a/src/main/java/net/helenus/core/operation/Operation.java +++ b/src/main/java/net/helenus/core/operation/Operation.java @@ -16,21 +16,19 @@ package net.helenus.core.operation; import java.net.InetAddress; -import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; -import com.datastax.driver.core.*; -import net.helenus.support.HelenusException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.codahale.metrics.Meter; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Timer; +import com.datastax.driver.core.*; import com.datastax.driver.core.querybuilder.BuiltStatement; import com.google.common.base.Stopwatch; @@ -40,6 +38,7 @@ import brave.propagation.TraceContext; import net.helenus.core.AbstractSessionOperations; import net.helenus.core.UnitOfWork; import net.helenus.core.cache.Facet; +import net.helenus.support.HelenusException; public abstract class Operation { @@ -118,27 +117,26 @@ public abstract class Operation { if (LOG.isDebugEnabled()) { ExecutionInfo ei = resultSet.getExecutionInfo(); Host qh = ei.getQueriedHost(); - String oh = ei.getTriedHosts().stream().map(Host::getAddress).map(InetAddress::toString).collect(Collectors.joining(", ")); + String oh = ei.getTriedHosts().stream().map(Host::getAddress).map(InetAddress::toString) + .collect(Collectors.joining(", ")); ConsistencyLevel cl = ei.getAchievedConsistencyLevel(); int se = ei.getSpeculativeExecutions(); String warn = ei.getWarnings().stream().collect(Collectors.joining(", ")); - String ri = String.format("%s %s %s %s %sd%s%s spec-retries: %d", - "C* v" + qh.getCassandraVersion(), - qh.getAddress().toString(), - qh.getDatacenter(), - qh.getRack(), + String ri = String.format("%s %s %s %s %sd%s%s spec-retries: %d", "C* v" + qh.getCassandraVersion(), + qh.getAddress().toString(), qh.getDatacenter(), qh.getRack(), (oh != null && !oh.equals("")) ? "[" + oh + "] " : "", - (cl != null) ? (" consistency: " + cl.name() + - (cl.isDCLocal() ? " DC " : "") + - (cl.isSerial() ? " SC " : "")) : "", - (warn != null && !warn.equals("")) ? ": " + warn : "", - se); + (cl != null) + ? (" consistency: " + cl.name() + (cl.isDCLocal() ? " DC " : "") + + (cl.isSerial() ? " SC " : "")) + : "", + (warn != null && !warn.equals("")) ? ": " + warn : "", se); if (uow != null) uow.setInfo(ri); else LOG.debug(ri); } - if (!resultSet.wasApplied() && !(columnDefinitions.size() > 1 || !columnDefinitions.contains("[applied]"))) { + if (!resultSet.wasApplied() + && !(columnDefinitions.size() > 1 || !columnDefinitions.contains("[applied]"))) { throw new HelenusException("Operation Failed"); } return resultSet; diff --git a/src/main/java/net/helenus/core/operation/SelectOperation.java b/src/main/java/net/helenus/core/operation/SelectOperation.java index 5c6ec45..6a39912 100644 --- a/src/main/java/net/helenus/core/operation/SelectOperation.java +++ b/src/main/java/net/helenus/core/operation/SelectOperation.java @@ -246,7 +246,7 @@ public final class SelectOperation extends AbstractFilterStreamOperation extends AbstractFilterStreamOperation filter : filters.values()) { where.and(filter.getClause(sessionOps.getValuePreparer())); - if (filter.getNode().getProperty().caseSensitiveIndex()) { - allowFiltering = true; - } - } + if (filter.getNode().getProperty().caseSensitiveIndex()) { + allowFiltering = true; + } + } } if (ifFilters != null && !ifFilters.isEmpty()) {