keith-turner commented on code in PR #4879:
URL: https://github.com/apache/accumulo/pull/4879#discussion_r1769356294


##########
server/monitor/src/main/java/org/apache/accumulo/monitor/util/logging/AccumuloMonitorAppender.java:
##########
@@ -122,14 +183,40 @@ public void append(final LogEvent event) {
 
         var req = 
HttpRequest.newBuilder(uri).POST(BodyPublishers.ofString(jsonEvent, UTF_8))
             .setHeader("Content-Type", "application/json").build();
-        @SuppressWarnings("unused")
-        var future = httpClient.sendAsync(req, BodyHandlers.discarding());
+
+        if (async) {
+          if (executor.getQueue().size() < queueSize) {
+            @SuppressWarnings("unused")
+            var future = httpClient.sendAsync(req, BodyHandlers.discarding());
+          } else {
+            discards.getAndIncrement();
+            error("Unable to send HTTP in appender [" + getName() + "]. Queue 
full. " + getStats());
+          }
+        } else {
+          httpClient.send(req, BodyHandlers.discarding());
+        }
       } catch (final Exception e) {
-        error("Unable to send HTTP in appender [" + getName() + "]", event, e);
+        errors.getAndIncrement();
+        error("Unable to send HTTP in appender [" + getName() + "] " + 
getStats(), event, e);
       }
+    }, () -> {
+      discards.getAndIncrement();
+      error("Unable to send HTTP in appender [" + getName() + "]. No monitor 
is running. "
+          + getStats());
     });
   }
 
+  @Override
+  protected boolean stop(long timeout, TimeUnit timeUnit, boolean 
changeLifeCycleState) {
+    if (changeLifeCycleState) {
+      setStopping();
+    }
+    if (executor != null) {
+      executor.shutdown();

Review Comment:
   I tried adding a print here and changing config and never saw output from 
the print stmt.  Need to retry this experiment to see if I did something wrong. 
 If this is called when log4j discards the appender, then calling shutdown here 
seems good.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to