Add MetaInfoManager API, remove MetaQueryStatistic entity bean, refactor query execution stats collection

This commit is contained in:
Rob Bygrave
2014-01-19 22:49:18 +13:00
parent 05dcdf162b
commit 6bd8c2bd05
40 changed files with 1375 additions and 1093 deletions
@@ -6,6 +6,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.persistence.PersistenceException;
@@ -39,6 +40,7 @@ import com.avaje.ebeaninternal.server.querydefn.OrmQueryProperties;
import com.avaje.ebeaninternal.server.transaction.DefaultPersistenceContext;
import com.avaje.ebeaninternal.server.type.DataBind;
import com.avaje.ebeaninternal.server.type.DataReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -204,8 +206,6 @@ public class CQuery<T> implements DbReadContext, CancelableQuery {
private final CQueryPlan queryPlan;
private long startNano;
private final Mode queryMode;
private final boolean autoFetchProfiling;
@@ -213,14 +213,17 @@ public class CQuery<T> implements DbReadContext, CancelableQuery {
private final ObjectGraphNode autoFetchParentNode;
private final AutoFetchManager autoFetchManager;
private final WeakReference<NodeUsageListener> autoFetchManagerRef;
private int executionTimeMicros;
private final Boolean readOnly;
private final SpiExpressionList<?> filterMany;
private long startNano;
private long executionTimeMicros;
/**
* Create the Sql select based on the request.
*/
@@ -520,7 +523,7 @@ public class CQuery<T> implements DbReadContext, CancelableQuery {
}
}
public int getQueryExecutionTimeMicros() {
public long getQueryExecutionTimeMicros() {
return executionTimeMicros;
}
@@ -638,7 +641,7 @@ public class CQuery<T> implements DbReadContext, CancelableQuery {
protected void updateExecutionStatistics() {
try {
long exeNano = System.nanoTime() - startNano;
executionTimeMicros = (int) exeNano / 1000;
executionTimeMicros = TimeUnit.NANOSECONDS.toMicros(exeNano);
if (autoFetchProfiling) {
autoFetchManager
@@ -674,7 +677,7 @@ public class CQuery<T> implements DbReadContext, CancelableQuery {
}
protected boolean hasNextBean(boolean inForeground) throws SQLException {
if (!readBeanInternal(inForeground)) {
return false;