1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-08-01 16:38:02 +08:00

Fix class not found

This commit is contained in:
dengchao@xgtl 2020-04-17 15:15:51 +08:00
parent e463139cc2
commit 4f8e19ba2f

View File

@ -8,24 +8,27 @@
*/
package mondrian.rolap;
import mondrian.olap.*;
import mondrian.olap.MondrianProperties;
import mondrian.olap.Util;
import mondrian.olap.Util.Functor1;
import mondrian.server.Execution;
import mondrian.server.Locus;
import mondrian.server.monitor.*;
import mondrian.server.monitor.SqlStatementEndEvent;
import mondrian.server.monitor.SqlStatementEvent;
import mondrian.server.monitor.SqlStatementEvent.Purpose;
import mondrian.util.*;
import mondrian.server.monitor.SqlStatementExecuteEvent;
import mondrian.server.monitor.SqlStatementStartEvent;
import mondrian.util.Counters;
import mondrian.util.DelegatingInvocationHandler;
import javax.sql.DataSource;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Proxy;
import java.sql.*;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicLong;
import javax.sql.DataSource;
/**
* SqlStatement contains a SQL statement and associated resources throughout
@ -66,8 +69,6 @@ public class SqlStatement {
MondrianProperties.instance().QueryLimit.get(), true);
private final DataSource dataSource;
private Connection jdbcConnection;
private ResultSet resultSet;
private final String sql;
private final List<Type> types;
private final int maxRows;
@ -75,14 +76,16 @@ public class SqlStatement {
private final Locus locus;
private final int resultSetType;
private final int resultSetConcurrency;
private boolean haveSemaphore;
private final List<Accessor> accessors = new ArrayList<Accessor>();
private final long id;
public int rowCount;
private final Functor1<Void, Statement> callback;
private Connection jdbcConnection;
private ResultSet resultSet;
private long startTimeNanos;
private long startTimeMillis;
private final List<Accessor> accessors = new ArrayList<Accessor>();
private State state = State.FRESH;
private final long id;
private Functor1<Void, Statement> callback;
private boolean haveSemaphore;
/**
* Creates a SqlStatement.
@ -107,8 +110,7 @@ public class SqlStatement {
Locus locus,
int resultSetType,
int resultSetConcurrency,
Util.Functor1<Void, Statement> callback)
{
Util.Functor1<Void, Statement> callback) {
this.callback = callback;
this.id = ID_GENERATOR.getAndIncrement();
this.dataSource = dataSource;
@ -139,21 +141,23 @@ public class SqlStatement {
querySemaphore.acquire();
haveSemaphore = true;
// Trace start of execution.
if (RolapUtil.SQL_LOGGER.isDebugEnabled()) {
StringBuilder sqllog = new StringBuilder();
sqllog.append(id)
.append(": ")
.append(locus.component)
.append(": executing sql [");
if (sql.indexOf('\n') >= 0) {
// SQL appears to be formatted as multiple lines. Make it
// start on its own line.
sqllog.append("\n");
}
sqllog.append(sql);
sqllog.append(']');
RolapUtil.SQL_LOGGER.debug(sqllog.toString());
}
//region org.apache.log4j.Logger is no longer exists
// if (RolapUtil.SQL_LOGGER.isDebugEnabled()) {
// StringBuilder sqllog = new StringBuilder();
// sqllog.append(id)
// .append(": ")
// .append(locus.component)
// .append(": executing sql [");
// if (sql.indexOf('\n') >= 0) {
// // SQL appears to be formatted as multiple lines. Make it
// // start on its own line.
// sqllog.append("\n");
// }
// sqllog.append(sql);
// sqllog.append(']');
// RolapUtil.SQL_LOGGER.debug(sqllog.toString());
// }
//endregion
// Execute hook.
RolapUtil.ExecuteQueryHook hook = RolapUtil.getHook();
@ -251,12 +255,14 @@ public class SqlStatement {
// Now handle this exception.
throw handle(e);
} finally {
RolapUtil.SQL_LOGGER.debug(id + ": " + status);
if (RolapUtil.LOGGER.isDebugEnabled()) {
RolapUtil.LOGGER.debug(
locus.component + ": executing sql [" + sql + "]" + status);
}
//region org.apache.log4j.Logger is no longer exists
// RolapUtil.SQL_LOGGER.debug(id + ": " + status);
//
// if (RolapUtil.LOGGER.isDebugEnabled()) {
// RolapUtil.LOGGER.debug(
// locus.component + ": executing sql [" + sql + "]" + status);
// }
//endregion
}
}
@ -305,7 +311,8 @@ public class SqlStatement {
locus.execution.getQueryTiming().markFull(
TIMING_NAME + locus.component, totalMs);
RolapUtil.SQL_LOGGER.debug(id + ": " + status);
// org.apache.log4j.Logger is no longer exists
// RolapUtil.SQL_LOGGER.debug(id + ": " + status);
Counters.SQL_STATEMENT_CLOSE_COUNT.incrementAndGet();
boolean remove = Counters.SQL_STATEMENT_EXECUTING_IDS.remove(id);
@ -313,11 +320,13 @@ public class SqlStatement {
+ ", close=" + Counters.SQL_STATEMENT_CLOSE_COUNT.get()
+ ", open=" + Counters.SQL_STATEMENT_EXECUTING_IDS;
if (RolapUtil.LOGGER.isDebugEnabled()) {
RolapUtil.LOGGER.debug(
locus.component + ": done executing sql [" + sql + "]"
+ status);
}
//region org.apache.log4j.Logger is no longer exists
// if (RolapUtil.LOGGER.isDebugEnabled()) {
// RolapUtil.LOGGER.debug(
// locus.component + ": done executing sql [" + sql + "]"
// + status);
// }
//endregion
if (!remove) {
throw new AssertionError(
@ -505,6 +514,13 @@ public class SqlStatement {
}
}
private enum State {
FRESH,
ACTIVE,
DONE,
CLOSED
}
public interface Accessor {
Object get() throws SQLException;
}
@ -517,8 +533,7 @@ public class SqlStatement {
*/
// must be public for reflection to work
public static class MyDelegatingInvocationHandler
extends DelegatingInvocationHandler
{
extends DelegatingInvocationHandler {
private final SqlStatement sqlStatement;
/**
@ -550,13 +565,6 @@ public class SqlStatement {
}
}
private enum State {
FRESH,
ACTIVE,
DONE,
CLOSED
}
public static class StatementLocus extends Locus {
private final SqlStatementEvent.Purpose purpose;
private final int cellRequestCount;
@ -566,8 +574,7 @@ public class SqlStatement {
String component,
String message,
SqlStatementEvent.Purpose purpose,
int cellRequestCount)
{
int cellRequestCount) {
super(
execution,
component,