Formatting.

This commit is contained in:
Greg Burd 2017-11-02 15:08:58 -04:00
parent e4cda1a268
commit 962145bf46
4 changed files with 33 additions and 36 deletions

View file

@ -306,9 +306,7 @@ public class HelenusSession extends AbstractSessionOperations implements Closeab
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);
name = (m.group(1) != null) ? m.group(1) : ((m.group(2) != null) ? m.group(2) : name);
} else {
name = classNameOnStack;
}

View file

@ -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;

View file

@ -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<E> {
@ -118,27 +117,26 @@ public abstract class Operation<E> {
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;