当前位置: 首页>>代码示例>>Java>>正文


Java ProfilerEvent类代码示例

本文整理汇总了Java中com.mysql.jdbc.profiler.ProfilerEvent的典型用法代码示例。如果您正苦于以下问题:Java ProfilerEvent类的具体用法?Java ProfilerEvent怎么用?Java ProfilerEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProfilerEvent类属于com.mysql.jdbc.profiler包,在下文中一共展示了ProfilerEvent类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: logInternal

import com.mysql.jdbc.profiler.ProfilerEvent; //导入依赖的package包/类
@Override
protected void logInternal(int level, Object msg, Throwable exception) {
    if (!this.hasNegativeDurations && msg instanceof ProfilerEvent) {
        this.hasNegativeDurations = ((ProfilerEvent) msg).getEventDuration() < 0;
    }
    super.logInternal(level, msg, exception);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:8,代码来源:TestBug57662Logger.java

示例2: logInternal

import com.mysql.jdbc.profiler.ProfilerEvent; //导入依赖的package包/类
private void logInternal(Level level, Object msg, Throwable exception) {
    //
    // only go through this exercise if the message will actually be logged.
    //

    if (this.jdkLogger.isLoggable(level)) {
        String messageAsString = null;
        String callerMethodName = "N/A";
        String callerClassName = "N/A";
        //int lineNumber = 0;
        //String fileName = "N/A";

        if (msg instanceof ProfilerEvent) {
            messageAsString = LogUtils.expandProfilerEventIfNecessary(msg).toString();
        } else {
            Throwable locationException = new Throwable();
            StackTraceElement[] locations = locationException.getStackTrace();

            int frameIdx = findCallerStackDepth(locations);

            if (frameIdx != 0) {
                callerClassName = locations[frameIdx].getClassName();
                callerMethodName = locations[frameIdx].getMethodName();
                //lineNumber = locations[frameIdx].getLineNumber();
                //fileName = locations[frameIdx].getFileName();
            }

            messageAsString = String.valueOf(msg);
        }

        if (exception == null) {
            this.jdkLogger.logp(level, callerClassName, callerMethodName, messageAsString);
        } else {
            this.jdkLogger.logp(level, callerClassName, callerMethodName, messageAsString, exception);
        }
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:38,代码来源:Jdk14Logger.java

示例3: issueConversionViaParsingWarning

import com.mysql.jdbc.profiler.ProfilerEvent; //导入依赖的package包/类
/**
 * @param string
 * @param mysqlType
 * @param s
 */
private void issueConversionViaParsingWarning(String methodName, int columnIndex, Object value, Field fieldInfo, int[] typesWithNoParseConversion)
        throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        StringBuilder originalQueryBuf = new StringBuilder();

        if (this.owningStatement != null && this.owningStatement instanceof com.mysql.jdbc.PreparedStatement) {
            originalQueryBuf.append(Messages.getString("ResultSet.CostlyConversionCreatedFromQuery"));
            originalQueryBuf.append(((com.mysql.jdbc.PreparedStatement) this.owningStatement).originalSql);
            originalQueryBuf.append("\n\n");
        } else {
            originalQueryBuf.append(".");
        }

        StringBuilder convertibleTypesBuf = new StringBuilder();

        for (int i = 0; i < typesWithNoParseConversion.length; i++) {
            convertibleTypesBuf.append(MysqlDefs.typeToName(typesWithNoParseConversion[i]));
            convertibleTypesBuf.append("\n");
        }

        String message = Messages.getString("ResultSet.CostlyConversion",
                new Object[] { methodName, Integer.valueOf(columnIndex + 1), fieldInfo.getOriginalName(), fieldInfo.getOriginalTableName(),
                        originalQueryBuf.toString(),
                        value != null ? value.getClass().getName()
                                : ResultSetMetaData.getClassNameForJavaType(fieldInfo.getSQLType(), fieldInfo.isUnsigned(), fieldInfo.getMysqlType(),
                                        fieldInfo.isBinary() || fieldInfo.isBlob(), fieldInfo.isOpaqueBinary(), this.connection.getYearIsDateType()),
                        MysqlDefs.typeToName(fieldInfo.getMysqlType()), convertibleTypesBuf.toString() });

        this.eventSink
                .consumeEvent(new ProfilerEvent(ProfilerEvent.TYPE_WARN, "", (this.owningStatement == null) ? "N/A" : this.owningStatement.currentCatalog,
                        this.connectionId, (this.owningStatement == null) ? (-1) : this.owningStatement.getId(), this.resultId, System.currentTimeMillis(),
                        0, Constants.MILLIS_I18N, null, this.pointOfOrigin, message));
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:40,代码来源:ResultSetImpl.java

示例4: realClose

import com.mysql.jdbc.profiler.ProfilerEvent; //导入依赖的package包/类
/**
 * Closes this statement, releasing all resources
 * 
 * @param calledExplicitly
 *            was this called by close()?
 * 
 * @throws SQLException
 *             if an error occurs
 */
@Override
protected void realClose(boolean calledExplicitly, boolean closeOpenResults) throws SQLException {
    MySQLConnection locallyScopedConn = this.connection;

    if (locallyScopedConn == null) {
        return; // already closed
    }

    synchronized (locallyScopedConn.getConnectionMutex()) {

        // additional check in case Statement was closed
        // while current thread was waiting for lock
        if (this.isClosed) {
            return;
        }

        if (this.useUsageAdvisor) {
            if (this.numberOfExecutions <= 1) {
                String message = Messages.getString("PreparedStatement.43");

                this.eventSink.consumeEvent(new ProfilerEvent(ProfilerEvent.TYPE_WARN, "", this.currentCatalog, this.connectionId, this.getId(), -1,
                        System.currentTimeMillis(), 0, Constants.MILLIS_I18N, null, this.pointOfOrigin, message));
            }
        }

        super.realClose(calledExplicitly, closeOpenResults);

        this.dbmd = null;
        this.originalSql = null;
        this.staticSqlStrings = null;
        this.parameterValues = null;
        this.parameterStreams = null;
        this.isStream = null;
        this.streamLengths = null;
        this.isNull = null;
        this.streamConvertBuf = null;
        this.parameterTypes = null;
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:49,代码来源:PreparedStatement.java

示例5: issueConversionViaParsingWarning

import com.mysql.jdbc.profiler.ProfilerEvent; //导入依赖的package包/类
/**
 * @param string
 * @param mysqlType
 * @param s
 */
private void issueConversionViaParsingWarning(String methodName, int columnIndex, Object value, Field fieldInfo, int[] typesWithNoParseConversion)
        throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        StringBuilder originalQueryBuf = new StringBuilder();

        if (this.owningStatement != null && this.owningStatement instanceof com.mysql.jdbc.PreparedStatement) {
            originalQueryBuf.append(Messages.getString("ResultSet.CostlyConversionCreatedFromQuery"));
            originalQueryBuf.append(((com.mysql.jdbc.PreparedStatement) this.owningStatement).originalSql);
            originalQueryBuf.append("\n\n");
        } else {
            originalQueryBuf.append(".");
        }

        StringBuilder convertibleTypesBuf = new StringBuilder();

        for (int i = 0; i < typesWithNoParseConversion.length; i++) {
            convertibleTypesBuf.append(MysqlDefs.typeToName(typesWithNoParseConversion[i]));
            convertibleTypesBuf.append("\n");
        }

        String message = Messages.getString(
                "ResultSet.CostlyConversion",
                new Object[] {
                        methodName,
                        Integer.valueOf(columnIndex + 1),
                        fieldInfo.getOriginalName(),
                        fieldInfo.getOriginalTableName(),
                        originalQueryBuf.toString(),
                        value != null ? value.getClass().getName() : ResultSetMetaData.getClassNameForJavaType(fieldInfo.getSQLType(),
                                fieldInfo.isUnsigned(), fieldInfo.getMysqlType(), fieldInfo.isBinary() || fieldInfo.isBlob(), fieldInfo.isOpaqueBinary(),
                                this.connection.getYearIsDateType()), MysqlDefs.typeToName(fieldInfo.getMysqlType()), convertibleTypesBuf.toString() });

        this.eventSink.consumeEvent(new ProfilerEvent(ProfilerEvent.TYPE_WARN, "", (this.owningStatement == null) ? "N/A"
                : this.owningStatement.currentCatalog, this.connectionId, (this.owningStatement == null) ? (-1) : this.owningStatement.getId(),
                this.resultId, System.currentTimeMillis(), 0, Constants.MILLIS_I18N, null, this.pointOfOrigin, message));
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:ResultSetImpl.java

示例6: realClose

import com.mysql.jdbc.profiler.ProfilerEvent; //导入依赖的package包/类
/**
 * Closes this statement, releasing all resources
 * 
 * @param calledExplicitly
 *            was this called by close()?
 * 
 * @throws SQLException
 *             if an error occurs
 */
@Override
protected void realClose(boolean calledExplicitly, boolean closeOpenResults) throws SQLException {
    MySQLConnection locallyScopedConn = this.connection;

    if (locallyScopedConn == null) {
        return; // already closed
    }

    synchronized (locallyScopedConn.getConnectionMutex()) {

        // additional check in case Statement was closed
        // while current thread was waiting for lock
        if (this.isClosed) {
            return;
        }

        if (this.useUsageAdvisor) {
            if (this.numberOfExecutions <= 1) {
                String message = Messages.getString("PreparedStatement.43");

                this.eventSink.consumeEvent(new ProfilerEvent(ProfilerEvent.TYPE_WARN, "", this.currentCatalog, this.connectionId, this.getId(), -1, System
                        .currentTimeMillis(), 0, Constants.MILLIS_I18N, null, this.pointOfOrigin, message));
            }
        }

        super.realClose(calledExplicitly, closeOpenResults);

        this.dbmd = null;
        this.originalSql = null;
        this.staticSqlStrings = null;
        this.parameterValues = null;
        this.parameterStreams = null;
        this.isStream = null;
        this.streamLengths = null;
        this.isNull = null;
        this.streamConvertBuf = null;
        this.parameterTypes = null;
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:49,代码来源:PreparedStatement.java

示例7: logInternal

import com.mysql.jdbc.profiler.ProfilerEvent; //导入依赖的package包/类
@Override
protected void logInternal(int level, Object msg, Throwable exception) {
	if (	!this.hasNegativeDurations &&
			msg instanceof ProfilerEvent) {
		this.hasNegativeDurations = ((ProfilerEvent) msg).getEventDuration() < 0;
	}
	super.logInternal(level, msg, exception);
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:9,代码来源:TestBug57662Logger.java

示例8: realClose

import com.mysql.jdbc.profiler.ProfilerEvent; //导入依赖的package包/类
/**
 * Closes this statement, releasing all resources
 * 
 * @param calledExplicitly
 *            was this called by close()?
 * 
 * @throws SQLException
 *             if an error occurs
 */
protected void realClose(boolean calledExplicitly, 
		boolean closeOpenResults) throws SQLException {
	MySQLConnection locallyScopedConn = this.connection;

	if (locallyScopedConn == null) return; // already closed

	synchronized (locallyScopedConn.getConnectionMutex()) {

		// additional check in case Statement was closed
		// while current thread was waiting for lock
		if (this.isClosed) return;

		if (this.useUsageAdvisor) {
			if (this.numberOfExecutions <= 1) {
				String message = Messages.getString("PreparedStatement.43"); //$NON-NLS-1$

				this.eventSink.consumeEvent(new ProfilerEvent(
						ProfilerEvent.TYPE_WARN, "", this.currentCatalog, //$NON-NLS-1$
						this.connectionId, this.getId(), -1, System
								.currentTimeMillis(), 0, Constants.MILLIS_I18N,
								null,
						this.pointOfOrigin, message));
			}
		}
		
		super.realClose(calledExplicitly, closeOpenResults);

		this.dbmd = null;
		this.originalSql = null;
		this.staticSqlStrings = null;
		this.parameterValues = null;
		this.parameterStreams = null;
		this.isStream = null;
		this.streamLengths = null;
		this.isNull = null;
		this.streamConvertBuf = null;
		this.parameterTypes = null;
	}
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:49,代码来源:PreparedStatement.java

示例9: issueConversionViaParsingWarning

import com.mysql.jdbc.profiler.ProfilerEvent; //导入依赖的package包/类
/**
 * @param string
 * @param mysqlType
 * @param s
 */
private void issueConversionViaParsingWarning(String methodName, int columnIndex, Object value, Field fieldInfo, int[] typesWithNoParseConversion)
        throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        StringBuffer originalQueryBuf = new StringBuffer();

        if (this.owningStatement != null && this.owningStatement instanceof com.mysql.jdbc.PreparedStatement) {
            originalQueryBuf.append(Messages.getString("ResultSet.CostlyConversionCreatedFromQuery"));
            originalQueryBuf.append(((com.mysql.jdbc.PreparedStatement) this.owningStatement).originalSql);
            originalQueryBuf.append("\n\n");
        } else {
            originalQueryBuf.append(".");
        }

        StringBuffer convertibleTypesBuf = new StringBuffer();

        for (int i = 0; i < typesWithNoParseConversion.length; i++) {
            convertibleTypesBuf.append(MysqlDefs.typeToName(typesWithNoParseConversion[i]));
            convertibleTypesBuf.append("\n");
        }

        String message = Messages.getString(
                "ResultSet.CostlyConversion",
                new Object[] {
                        methodName,
                        Integer.valueOf(columnIndex + 1),
                        fieldInfo.getOriginalName(),
                        fieldInfo.getOriginalTableName(),
                        originalQueryBuf.toString(),
                        value != null ? value.getClass().getName() : ResultSetMetaData.getClassNameForJavaType(fieldInfo.getSQLType(),
                                fieldInfo.isUnsigned(), fieldInfo.getMysqlType(), fieldInfo.isBinary() || fieldInfo.isBlob(), fieldInfo.isOpaqueBinary(),
                                this.connection.getYearIsDateType()), MysqlDefs.typeToName(fieldInfo.getMysqlType()), convertibleTypesBuf.toString() });

        this.eventSink.consumeEvent(new ProfilerEvent(ProfilerEvent.TYPE_WARN, "", (this.owningStatement == null) ? "N/A"
                : this.owningStatement.currentCatalog, this.connectionId, (this.owningStatement == null) ? (-1) : this.owningStatement.getId(),
                this.resultId, System.currentTimeMillis(), 0, Constants.MILLIS_I18N, null, this.pointOfOrigin, message));
    }
}
 
开发者ID:BasThomas,项目名称:SMPT42,代码行数:43,代码来源:ResultSetImpl.java

示例10: realClose

import com.mysql.jdbc.profiler.ProfilerEvent; //导入依赖的package包/类
/**
 * Closes this statement, releasing all resources
 * 
 * @param calledExplicitly
 *            was this called by close()?
 * 
 * @throws SQLException
 *             if an error occurs
 */
protected void realClose(boolean calledExplicitly, 
		boolean closeOpenResults) throws SQLException {
	MySQLConnection locallyScopedConn;
	
	try {
		locallyScopedConn = checkClosed();
	} catch (SQLException sqlEx) {
		return; // already closed
	}
	
	synchronized (locallyScopedConn.getConnectionMutex()) {
	
		if (this.useUsageAdvisor) {
			if (this.numberOfExecutions <= 1) {
				String message = Messages.getString("PreparedStatement.43"); //$NON-NLS-1$

				this.eventSink.consumeEvent(new ProfilerEvent(
						ProfilerEvent.TYPE_WARN, "", this.currentCatalog, //$NON-NLS-1$
						this.connectionId, this.getId(), -1, System
								.currentTimeMillis(), 0, Constants.MILLIS_I18N,
								null,
						this.pointOfOrigin, message));
			}
		}
		
		super.realClose(calledExplicitly, closeOpenResults);

		this.dbmd = null;
		this.originalSql = null;
		this.staticSqlStrings = null;
		this.parameterValues = null;
		this.parameterStreams = null;
		this.isStream = null;
		this.streamLengths = null;
		this.isNull = null;
		this.streamConvertBuf = null;
		this.parameterTypes = null;
	}
}
 
开发者ID:OrlandoLee,项目名称:ForYou,代码行数:49,代码来源:PreparedStatement.java


注:本文中的com.mysql.jdbc.profiler.ProfilerEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。