Skip to content

Commit 2cdb0f2

Browse files
chore: add additional logging for efm
1 parent 987fd41 commit 2cdb0f2

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

wrapper/src/main/java/software/amazon/jdbc/plugin/efm/MonitorImpl.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ public MonitorImpl(
9494

9595
@Override
9696
public void startMonitoring(final MonitorConnectionContext context) {
97+
if (this.stopped) {
98+
LOGGER.warning(() -> Messages.get("MonitorImpl.monitorIsStopped"));
99+
}
97100
final long currentTimeNano = this.getCurrentTimeNano();
98101
context.setStartMonitorTimeNano(currentTimeNano);
99102
this.contextLastUsedTimestampNano = currentTimeNano;
@@ -220,14 +223,17 @@ public void run() {
220223
TimeUnit.MILLISECONDS.sleep(THREAD_SLEEP_WHEN_INACTIVE_MILLIS);
221224
}
222225
}
223-
} catch (final InterruptedException intEx) {
226+
} catch (final Exception ex) {
224227
// do nothing; exit thread
228+
LOGGER.warning(() -> Messages.get("MonitorImpl.exceptionDuringMonitoring", new Object[] {ex.getMessage()}));
225229
} finally {
226230
if (this.monitoringConn != null) {
227231
try {
228232
this.monitoringConn.close();
229233
} catch (final SQLException ex) {
230234
// ignore
235+
LOGGER.warning(
236+
() -> Messages.get("MonitorImpl.exceptionClosingMonitoringConn", new Object[] {ex.getMessage()}));
231237
}
232238
}
233239
this.stopped = true;

wrapper/src/main/resources/aws_advanced_jdbc_wrapper_messages.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ MonitorThreadContainer.emptyNodeKeys=Provided node keys are empty.
188188

189189
# Monitor Impl
190190
MonitorImpl.contextNullWarning=Parameter 'context' should not be null.
191+
MonitorImpl.exceptionClosingMonitoringConn=An exception was thrown when trying to close the monitoring connection: {0}
192+
MonitorImpl.exceptionDuringMonitoring=An exception was thrown during monitoring: {0}
193+
MonitorImpl.monitorIsStopped=Monitor has already stopped.
191194

192195
# Monitor Service Impl
193196
MonitorServiceImpl.nullMonitorParam=Parameter 'monitor' should not be null.

0 commit comments

Comments
 (0)