Skip to content

Commit

Permalink
Merge pull request #3628 from AmilaSamith/master
Browse files Browse the repository at this point in the history
Add fix for issue in request box error scenario
  • Loading branch information
AmilaSamith authored Sep 25, 2024
2 parents 820a8c3 + ed09c51 commit cdc4ab4
Showing 1 changed file with 27 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,42 +183,37 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl

String name = method.getName();
boolean close = CorrelationLogInterceptor.this.compare("close", name);
try {
//Checks if the method name is of type closed and will not log time taken for those methods
if (close && this.closed) {
return null;
} else if (CorrelationLogInterceptor.this.compare("isClosed", name)) {
return this.closed;
} else if (this.closed) {
throw new SQLException("Statement closed.");
} else {
boolean process;
process = CorrelationLogInterceptor.this.isExecute(method, false);

long start = System.currentTimeMillis();
Object result = null;

if (this.delegate != null) {
result = method.invoke(this.delegate, args);
}
//Checks if the method name is of type closed and will not log time taken for those methods
if (close && this.closed) {
return null;
} else if (CorrelationLogInterceptor.this.compare("isClosed", name)) {
return this.closed;
} else if (this.closed) {
throw new SQLException("Statement closed.");
} else {
boolean process;
process = CorrelationLogInterceptor.this.isExecute(method, false);

//If the query is an execute type of query the time taken is calculated and logged
if (process) {
long delta = System.currentTimeMillis() - start;
CorrelationLogInterceptor.this.reportQuery(this.query, args, name, start, delta);
logQueryDetails(start, delta, name);
}
long start = System.currentTimeMillis();
Object result = null;

if (close) {
this.closed = true;
this.delegate = null;
}
if (this.delegate != null) {
result = method.invoke(this.delegate, args);
}

return result;
//If the query is an execute type of query the time taken is calculated and logged
if (process) {
long delta = System.currentTimeMillis() - start;
CorrelationLogInterceptor.this.reportQuery(this.query, args, name, start, delta);
logQueryDetails(start, delta, name);
}
} catch (Exception e) {
log.error("Unable get query run-time", e);
return null;

if (close) {
this.closed = true;
this.delegate = null;
}

return result;
}
}

Expand Down

0 comments on commit cdc4ab4

Please sign in to comment.