mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-27 00:02:42 +00:00
#1027 - ENH: Add a Slow query event listener ... to log or listen to queries that exceed some defined execution time
This commit is contained in:
@@ -39,7 +39,7 @@ class CQueryUpdate {
|
||||
|
||||
private String bindLog;
|
||||
|
||||
private int executionTimeMicros;
|
||||
private long executionTimeMicros;
|
||||
|
||||
private int rowCount;
|
||||
|
||||
@@ -90,7 +90,6 @@ class CQueryUpdate {
|
||||
|
||||
long startNano = System.nanoTime();
|
||||
try {
|
||||
|
||||
SpiTransaction t = request.getTransaction();
|
||||
Connection conn = t.getInternalConnection();
|
||||
pstmt = conn.prepareStatement(sql);
|
||||
@@ -102,9 +101,8 @@ class CQueryUpdate {
|
||||
bindLog = predicates.bind(pstmt, conn);
|
||||
rowCount = pstmt.executeUpdate();
|
||||
|
||||
long exeNano = System.nanoTime() - startNano;
|
||||
executionTimeMicros = (int) exeNano / 1000;
|
||||
|
||||
executionTimeMicros = (System.nanoTime() - startNano) / 1000L;
|
||||
request.slowQueryCheck(executionTimeMicros, rowCount);
|
||||
return rowCount;
|
||||
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user