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


Java ProfilerEventHandler类代码示例

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


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

示例1: removeInstance

import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public static synchronized void removeInstance(MySQLConnection conn) {
    ProfilerEventHandler handler = conn.getProfilerEventHandlerInstance();

    if (handler != null) {
        handler.destroy();
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:8,代码来源:ProfilerEventHandlerFactory.java

示例2: removeInstance

import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public static synchronized void removeInstance(MySQLConnection conn) {
	ProfilerEventHandler handler = conn.getProfilerEventHandlerInstance();
	
	if (handler != null) {
		handler.destroy();
	}
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:8,代码来源:ProfilerEventHandlerFactory.java

示例3: removeInstance

import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public static synchronized void removeInstance(Connection conn) {
	ProfilerEventHandler handler = CONNECTIONS_TO_SINKS.remove(conn);
	
	if (handler != null) {
		handler.destroy();
	}
}
 
开发者ID:alexf101,项目名称:indoor-tracking,代码行数:8,代码来源:ProfilerEventHandlerFactory.java

示例4: getProfilerEventHandlerInstance

import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public ProfilerEventHandler getProfilerEventHandlerInstance() {
    return null;
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:4,代码来源:FabricMySQLConnectionProxy.java

示例5: setProfilerEventHandlerInstance

import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public void setProfilerEventHandlerInstance(ProfilerEventHandler h) {
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:3,代码来源:FabricMySQLConnectionProxy.java

示例6: close

import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
/**
 * We're done.
 * 
 * @throws SQLException
 *             if a database error occurs
 */
public void close() throws SQLException {
    // Belt and suspenders here - if we don't have a reference to the connection it's more than likely dead/gone and we won't be able to consume rows anyway

    Object mutex = this;

    MySQLConnection conn = null;

    if (this.owner != null) {
        conn = this.owner.connection;

        if (conn != null) {
            mutex = conn.getConnectionMutex();
        }
    }

    boolean hadMore = false;
    int howMuchMore = 0;

    synchronized (mutex) {
        // drain the rest of the records.
        while (next() != null) {
            hadMore = true;
            howMuchMore++;

            if (howMuchMore % 100 == 0) {
                Thread.yield();
            }
        }

        if (conn != null) {
            if (!conn.getClobberStreamingResults() && conn.getNetTimeoutForStreamingResults() > 0) {
                String oldValue = conn.getServerVariable("net_write_timeout");

                if (oldValue == null || oldValue.length() == 0) {
                    oldValue = "60"; // the current default
                }

                this.io.clearInputStream();

                java.sql.Statement stmt = null;

                try {
                    stmt = conn.createStatement();
                    ((com.mysql.jdbc.StatementImpl) stmt).executeSimpleNonQuery(conn, "SET net_write_timeout=" + oldValue);
                } finally {
                    if (stmt != null) {
                        stmt.close();
                    }
                }
            }

            if (conn.getUseUsageAdvisor()) {
                if (hadMore) {

                    ProfilerEventHandler eventSink = ProfilerEventHandlerFactory.getInstance(conn);

                    eventSink.consumeEvent(new ProfilerEvent(ProfilerEvent.TYPE_WARN, "",
                            this.owner.owningStatement == null ? "N/A" : this.owner.owningStatement.currentCatalog, this.owner.connectionId,
                            this.owner.owningStatement == null ? -1 : this.owner.owningStatement.getId(), -1, System.currentTimeMillis(), 0,
                            Constants.MILLIS_I18N, null, null,
                            Messages.getString("RowDataDynamic.2") + howMuchMore + Messages.getString("RowDataDynamic.3")
                                    + Messages.getString("RowDataDynamic.4") + Messages.getString("RowDataDynamic.5")
                                    + Messages.getString("RowDataDynamic.6") + this.owner.pointOfOrigin));
                }
            }
        }
    }

    this.metadata = null;
    this.owner = null;
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:78,代码来源:RowDataDynamic.java

示例7: getProfilerEventHandlerInstance

import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public ProfilerEventHandler getProfilerEventHandlerInstance() {
    return this.eventSink;
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:4,代码来源:ConnectionImpl.java

示例8: setProfilerEventHandlerInstance

import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public void setProfilerEventHandlerInstance(ProfilerEventHandler h) {
    this.eventSink = h;
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:4,代码来源:ConnectionImpl.java

示例9: getProfilerEventHandlerInstance

import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public ProfilerEventHandler getProfilerEventHandlerInstance() {
    return getActiveMySQLConnection().getProfilerEventHandlerInstance();
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:4,代码来源:MultiHostMySQLConnection.java

示例10: setProfilerEventHandlerInstance

import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public void setProfilerEventHandlerInstance(ProfilerEventHandler h) {
    getActiveMySQLConnection().setProfilerEventHandlerInstance(h);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:4,代码来源:MultiHostMySQLConnection.java

示例11: close

import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
/**
 * We're done.
 * 
 * @throws SQLException
 *             if a database error occurs
 */
public void close() throws SQLException {
    // Belt and suspenders here - if we don't have a reference to the connection it's more than likely dead/gone and we won't be able to consume rows anyway

    Object mutex = this;

    MySQLConnection conn = null;

    if (this.owner != null) {
        conn = this.owner.connection;

        if (conn != null) {
            mutex = conn.getConnectionMutex();
        }
    }

    boolean hadMore = false;
    int howMuchMore = 0;

    synchronized (mutex) {
        // drain the rest of the records.
        while (next() != null) {
            hadMore = true;
            howMuchMore++;

            if (howMuchMore % 100 == 0) {
                Thread.yield();
            }
        }

        if (conn != null) {
            if (!conn.getClobberStreamingResults() && conn.getNetTimeoutForStreamingResults() > 0) {
                String oldValue = conn.getServerVariable("net_write_timeout");

                if (oldValue == null || oldValue.length() == 0) {
                    oldValue = "60"; // the current default
                }

                this.io.clearInputStream();

                java.sql.Statement stmt = null;

                try {
                    stmt = conn.createStatement();
                    ((com.mysql.jdbc.StatementImpl) stmt).executeSimpleNonQuery(conn, "SET net_write_timeout=" + oldValue);
                } finally {
                    if (stmt != null) {
                        stmt.close();
                    }
                }
            }

            if (conn.getUseUsageAdvisor()) {
                if (hadMore) {

                    ProfilerEventHandler eventSink = ProfilerEventHandlerFactory.getInstance(conn);

                    eventSink.consumeEvent(new ProfilerEvent(ProfilerEvent.TYPE_WARN, "", this.owner.owningStatement == null ? "N/A"
                            : this.owner.owningStatement.currentCatalog, this.owner.connectionId, this.owner.owningStatement == null ? -1
                            : this.owner.owningStatement.getId(), -1, System.currentTimeMillis(), 0, Constants.MILLIS_I18N, null, null, Messages
                            .getString("RowDataDynamic.2")
                            + howMuchMore
                            + Messages.getString("RowDataDynamic.3")
                            + Messages.getString("RowDataDynamic.4")
                            + Messages.getString("RowDataDynamic.5") + Messages.getString("RowDataDynamic.6") + this.owner.pointOfOrigin));
                }
            }
        }
    }

    this.metadata = null;
    this.owner = null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:79,代码来源:RowDataDynamic.java


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