本文整理汇总了Java中mondrian.rolap.RolapUtil类的典型用法代码示例。如果您正苦于以下问题:Java RolapUtil类的具体用法?Java RolapUtil怎么用?Java RolapUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RolapUtil类属于mondrian.rolap包,在下文中一共展示了RolapUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeEldestEntry
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
protected boolean removeEldestEntry(
Map.Entry<Integer, MutableConnectionInfo> e)
{
if (size() > maxSize) {
if (RolapUtil.MONITOR_LOGGER.isTraceEnabled()) {
RolapUtil.MONITOR_LOGGER.trace(
"ConnectionInfo("
+ e.getKey()
+ ") evicted. Stack is:"
+ Util.nl
+ e.getValue().stack);
}
return true;
}
return false;
}
示例2: visit
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
public Object visit(ConnectionStartEvent event) {
final MutableConnectionInfo conn =
new MutableConnectionInfo(event.stack);
connectionMap.put(event.connectionId, conn);
foo(conn, event);
foo(server.aggConn, event);
if (RolapUtil.MONITOR_LOGGER.isTraceEnabled()) {
RolapUtil.MONITOR_LOGGER.trace(
"Connection("
+ event.connectionId
+ ") created. stack is:"
+ Util.nl
+ event.stack);
}
return null;
}
示例3: Event
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
/**
* Creates an Event.
*
* @param timestamp Timestamp
*
*/
public Event(
long timestamp)
{
this.timestamp = timestamp;
if (RolapUtil.MONITOR_LOGGER.isTraceEnabled()) {
try {
throw new Exception();
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
this.stack = sw.toString();
}
} else {
this.stack = null;
}
}
示例4: checkInList
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
public BitKey checkInList(BitKey inListLHSBitKey) {
// ValueColumn predicate by itself is not using IN list; when it is
// one of the children to an OR predicate, then using IN list
// is helpful. The later is checked by passing in a bitmap that
// represent the LHS or the IN list, i.e. the column that is
// constrained by the OR.
BitKey inListRHSBitKey = inListLHSBitKey.copy();
if (!getConstrainedColumnBitKey().equals(inListLHSBitKey)
|| value == RolapUtil.sqlNullValue)
{
inListRHSBitKey.clear();
}
return inListRHSBitKey;
}
示例5: getTableCardinality
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
public int getTableCardinality(
Dialect dialect,
DataSource dataSource,
String catalog,
String schema,
String table,
Execution execution)
{
StringBuilder buf = new StringBuilder("select count(*) from ");
dialect.quoteIdentifier(buf, catalog, schema, table);
final String sql = buf.toString();
SqlStatement stmt =
RolapUtil.executeQuery(
dataSource,
sql,
new Locus(
execution,
"SqlStatisticsProvider.getTableCardinality",
"Reading row count from table "
+ Arrays.asList(catalog, schema, table)));
try {
ResultSet resultSet = stmt.getResultSet();
if (resultSet.next()) {
++stmt.rowCount;
return resultSet.getInt(1);
}
return -1; // huh?
} catch (SQLException e) {
throw stmt.handle(e);
} finally {
stmt.close();
}
}
示例6: getQueryCardinality
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
public int getQueryCardinality(
Dialect dialect,
DataSource dataSource,
String sql,
Execution execution)
{
final StringBuilder buf = new StringBuilder();
buf.append(
"select count(*) from (").append(sql).append(")");
if (dialect.requiresAliasForFromQuery()) {
if (dialect.allowsAs()) {
buf.append(" as ");
} else {
buf.append(" ");
}
dialect.quoteIdentifier(buf, "init");
}
final String countSql = buf.toString();
SqlStatement stmt =
RolapUtil.executeQuery(
dataSource,
countSql,
new Locus(
execution,
"SqlStatisticsProvider.getQueryCardinality",
"Reading row count from query [" + sql + "]"));
try {
ResultSet resultSet = stmt.getResultSet();
if (resultSet.next()) {
++stmt.rowCount;
return resultSet.getInt(1);
}
return -1; // huh?
} catch (SQLException e) {
throw stmt.handle(e);
} finally {
stmt.close();
}
}
示例7: getColumnCardinality
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
public int getColumnCardinality(
Dialect dialect,
DataSource dataSource,
String catalog,
String schema,
String table,
String column,
Execution execution)
{
final String sql =
generateColumnCardinalitySql(
dialect, schema, table, column);
if (sql == null) {
return -1;
}
SqlStatement stmt =
RolapUtil.executeQuery(
dataSource,
sql,
new Locus(
execution,
"SqlStatisticsProvider.getColumnCardinality",
"Reading cardinality for column "
+ Arrays.asList(catalog, schema, table, column)));
try {
ResultSet resultSet = stmt.getResultSet();
if (resultSet.next()) {
++stmt.rowCount;
return resultSet.getInt(1);
}
return -1; // huh?
} catch (SQLException e) {
throw stmt.handle(e);
} finally {
stmt.close();
}
}
示例8: toArray
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
private static Comparable[] toArray(
SortedSet<Comparable> keySet,
boolean hasNull)
{
int size = keySet.size();
if (hasNull) {
size++;
}
Comparable[] keys = keySet.toArray(new Comparable[size]);
if (hasNull) {
keys[size - 1] = RolapUtil.sqlNullValue;
}
return keys;
}
示例9: getValuesAndIndicator
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
public Pair<SortedSet<Comparable>, Boolean> getValuesAndIndicator() {
if (keys.length > 0
&& keys[keys.length - 1] == RolapUtil.sqlNullValue)
{
return (Pair) Pair.of(
new ArraySortedSet(keys, 0, keys.length - 1),
Boolean.TRUE);
} else {
return (Pair) Pair.of(
new ArraySortedSet(keys),
Boolean.FALSE);
}
}
示例10: run
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
public void run() {
try {
for (;;) {
try {
final Pair<Handler, Message> entry = eventQueue.take();
final Handler handler = entry.left;
final Message message = entry.right;
final Object result = message.accept(handler);
if (message instanceof Command) {
responseMap.put((Command) message, result);
} else {
// Broadcast the event to anyone who is interested.
RolapUtil.MONITOR_LOGGER.debug(message);
}
if (message instanceof ShutdownCommand) {
LOGGER.debug(
"ShutdownCommand received. Monitor thread is shutting down.");
return;
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
LOGGER.warn(
"Monitor thread interrupted.",
e);
return;
} catch (Throwable t) {
LOGGER.error(
"Runtime error on the monitor thread.",
t);
}
}
} finally {
running = false;
}
}
示例11: binarySearch
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
public <T extends Comparable<T>> int binarySearch(
T[] ts, int start, int end, T t)
{
return Arrays.binarySearch(
ts, start, end, t,
RolapUtil.ROLAP_COMPARATOR);
}
示例12: binarySearch
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
public <T extends Comparable<T>> int binarySearch(
T[] ts, int start, int end, T t)
{
final int i = Collections.binarySearch(
Arrays.asList(ts).subList(start, end), t,
RolapUtil.ROLAP_COMPARATOR);
return (i < 0) ? (i - start) : (i + start);
}
示例13: testRolapUtilComparator
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
public void testRolapUtilComparator() throws Exception {
final Comparable[] compArray =
new Comparable[] {
"1",
"2",
"3",
"4"
};
// Will throw a ClassCastException if it fails.
Util.binarySearch(
compArray, 0, compArray.length,
RolapUtil.sqlNullValue);
}
示例14: initialize
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
public void initialize() throws Exception {
if (this.initialize) {
return;
}
check();
if (this.connection == null) {
RolapUtil.loadDrivers(this.jdbcDriver);
if (this.userName == null) {
this.connection = DriverManager.getConnection(this.jdbcURL);
} else {
this.connection = DriverManager.getConnection(
this.jdbcURL, this.userName, this.password);
}
}
final DatabaseMetaData metaData = this.connection.getMetaData();
String productName = metaData.getDatabaseProductName();
String version = metaData.getDatabaseProductVersion();
LOGGER.info("Output connection is " + productName + ", " + version);
if (!metaData.supportsBatchUpdates()) {
this.batchSize = 1;
}
this.dialect = DialectManager.createDialect(null, this.connection);
this.initialize = true;
}
示例15: executeAndCancelAtSqlFetch
import mondrian.rolap.RolapUtil; //导入依赖的package包/类
private Long executeAndCancelAtSqlFetch(
final String query, final String triggerSql, final String component)
throws Exception
{
// avoid cache to ensure sql executes
TestContext context = getTestContext().withFreshConnection();
context.flushSchemaCache();
RolapConnection conn = (RolapConnection) context.getConnection();
final mondrian.server.Statement stmt = conn.getInternalStatement();
// use the logger to block and trigger cancelation at the right time
Logger sqlLog = RolapUtil.SQL_LOGGER;
propSaver.set(sqlLog, org.apache.log4j.Level.DEBUG);
final Execution exec = new Execution(stmt, 50000);
final CountDownLatch okToGo = new CountDownLatch(1);
SqlCancelingAppender canceler =
new SqlCancelingAppender(component, triggerSql, exec, okToGo);
stmt.setQuery(conn.parseQuery(query));
sqlLog.addAppender(canceler);
try {
conn.execute(exec);
Assert.fail("Query not canceled.");
} catch (QueryCanceledException e) {
// 5 sec just in case it all goes wrong
if (!okToGo.await(5, TimeUnit.SECONDS)) {
Assert.fail("Timeout reading sql statement end from log.");
}
return canceler.rows;
} finally {
sqlLog.removeAppender(canceler);
context.close();
}
return null;
}