本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例4: getProfilerEventHandlerInstance
import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public ProfilerEventHandler getProfilerEventHandlerInstance() {
return null;
}
示例5: setProfilerEventHandlerInstance
import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public void setProfilerEventHandlerInstance(ProfilerEventHandler h) {
}
示例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;
}
示例7: getProfilerEventHandlerInstance
import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public ProfilerEventHandler getProfilerEventHandlerInstance() {
return this.eventSink;
}
示例8: setProfilerEventHandlerInstance
import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public void setProfilerEventHandlerInstance(ProfilerEventHandler h) {
this.eventSink = h;
}
示例9: getProfilerEventHandlerInstance
import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public ProfilerEventHandler getProfilerEventHandlerInstance() {
return getActiveMySQLConnection().getProfilerEventHandlerInstance();
}
示例10: setProfilerEventHandlerInstance
import com.mysql.jdbc.profiler.ProfilerEventHandler; //导入依赖的package包/类
public void setProfilerEventHandlerInstance(ProfilerEventHandler h) {
getActiveMySQLConnection().setProfilerEventHandlerInstance(h);
}
示例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;
}