brusdev commented on code in PR #4526:
URL: https://github.com/apache/activemq-artemis/pull/4526#discussion_r1256038651


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/OperationContextImpl.java:
##########
@@ -104,6 +110,24 @@ public static void setContext(final OperationContext 
context) {
 
    private final Executor executor;
 
+   private static int maxDebugTrackers = Integer.parseInt(
+      System.getProperty("ARTEMIS_OPCONTEXT_MAX_DEBUG_TRACKERS", "0"));
+
+   private Buffer debugTrackers = OperationContextImpl.maxDebugTrackers > 0 ?
+      BufferUtils.synchronizedBuffer(new 
CircularFifoBuffer(OperationContextImpl.maxDebugTrackers)) : null;
+
+   public static int getMaxDebugTrackers() {
+      return OperationContextImpl.maxDebugTrackers;
+   }
+
+   public static void setMaxDebugTrackers(int maxDebugTrackers) {

Review Comment:
   done



##########
artemis-server/src/test/java/org/apache/activemq/artemis/core/persistence/impl/journal/OperationContextUnitTest.java:
##########
@@ -422,4 +422,43 @@ public void onError(final int errorCode, final String 
errorMessage) {
       Assert.assertEquals(0, operations.get());
    }
 
+   @Test
+   public void testContextWithoutDebugTrackers() {
+      ExecutorService executor = 
Executors.newSingleThreadExecutor(ActiveMQThreadFactory.defaultThreadFactory(getClass().getName()));
+
+      Assert.assertEquals(0, OperationContextImpl.getMaxDebugTrackers());
+      OperationContextImpl context = new OperationContextImpl(executor);
+      Assert.assertNull(context.getDebugTrackers());
+
+      context.storeLineUp();
+      Assert.assertNull(context.getDebugTrackers());
+
+      context.done();
+      Assert.assertNull(context.getDebugTrackers());
+   }
+
+   @Test
+   public void testContextWithDebugTrackers() {
+      int maxStoreOperationTrackers = 
OperationContextImpl.getMaxDebugTrackers();
+      ExecutorService executor = 
Executors.newSingleThreadExecutor(ActiveMQThreadFactory.defaultThreadFactory(getClass().getName()));

Review Comment:
   done



-- 
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