test_class.file: oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/async/CacheActionDispatcherTest.java
test_class.identifier: CacheActionDispatcherTest
test_case.body: @Test
      public void testMaxQueueSize() {
          CacheActionDispatcher dispatcher = new CacheActionDispatcher();
  
          for (int i = 0; i < MAX_SIZE + 10; i++) {
              dispatcher.add(createWriteAction(valueOf(i)));
          }
          assertEquals(MAX_SIZE, dispatcher.queue.size());
          assertEquals("0", dispatcher.queue.peek().toString());
      }
test_case.class_method_signature: CacheActionDispatcherTest.testMaxQueueSize()
test_case.full_signature: @Test public void testMaxQueueSize()
test_case.identifier: testMaxQueueSize
test_case.invocations: add createWriteAction valueOf assertEquals size assertEquals toString peek
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMaxQueueSize()
focal_class.declarator: LOG = LoggerFactory.getLogger(CacheActionDispatcher.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(CacheActionDispatcher.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: DEFAULT_MAX_MEMORY = 32 * 1024 * 1024
focal_class.modifier: private static final
focal_class.original_string: private static final long DEFAULT_MAX_MEMORY = 32 * 1024 * 1024;
focal_class.type: long
focal_class.var_name: DEFAULT_MAX_MEMORY
focal_class.declarator: MAX_SIZE = 16 * 1024
focal_class.modifier: static final
focal_class.original_string: static final int MAX_SIZE = 16 * 1024;
focal_class.type: int
focal_class.var_name: MAX_SIZE
focal_class.declarator: queue = new ArrayBlockingQueue<>(MAX_SIZE)
focal_class.modifier: final
focal_class.original_string: final BlockingQueue<CacheAction> queue = new ArrayBlockingQueue<>(MAX_SIZE);
focal_class.type: BlockingQueue<CacheAction>
focal_class.var_name: queue
focal_class.declarator: maxMemory
focal_class.modifier: private final
focal_class.original_string: private final long maxMemory;
focal_class.type: long
focal_class.var_name: maxMemory
focal_class.declarator: memory = 0
focal_class.modifier: private
focal_class.original_string: private long memory = 0;
focal_class.type: long
focal_class.var_name: memory
focal_class.declarator: monitor = new Object()
focal_class.modifier: private final
focal_class.original_string: private final Object monitor = new Object();
focal_class.type: Object
focal_class.var_name: monitor
focal_class.declarator: isRunning = true
focal_class.modifier: private volatile
focal_class.original_string: private volatile boolean isRunning = true;
focal_class.type: boolean
focal_class.var_name: isRunning
focal_class.file: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/async/CacheActionDispatcher.java
focal_class.identifier: CacheActionDispatcher
focal_class.interfaces: implements Runnable
focal_class.class_method_signature: CacheActionDispatcher.CacheActionDispatcher()
focal_class.full_signature: public  CacheActionDispatcher()
focal_class.identifier: CacheActionDispatcher
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  CacheActionDispatcher()
focal_class.class_method_signature: CacheActionDispatcher.CacheActionDispatcher(long maxMemory)
focal_class.full_signature:   CacheActionDispatcher(long maxMemory)
focal_class.identifier: CacheActionDispatcher
focal_class.parameters: (long maxMemory)
focal_class.signature:  CacheActionDispatcher(long maxMemory)
focal_class.class_method_signature: CacheActionDispatcher.run()
focal_class.full_signature: @Override public void run()
focal_class.identifier: run
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void run()
focal_class.class_method_signature: CacheActionDispatcher.stop()
focal_class.full_signature: public void stop()
focal_class.identifier: stop
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void stop()
focal_class.class_method_signature: CacheActionDispatcher.add(CacheAction action)
focal_class.full_signature:  boolean add(CacheAction action)
focal_class.identifier: add
focal_class.parameters: (CacheAction action)
focal_class.return: boolean
focal_class.signature: boolean add(CacheAction action)
focal_class.class_method_signature: CacheActionDispatcher.getMemory()
focal_class.full_signature:  long getMemory()
focal_class.identifier: getMemory
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getMemory()
focal_method.body: boolean add(CacheAction action) {
          int m = action.getMemory();
          synchronized (monitor) {
              // check if the queue reached memory limit and accepts action
              if (memory + m <= maxMemory && queue.offer(action)) {
                  memory += m;
                  return true;
              }
          }
          return false;
      }
focal_method.class_method_signature: CacheActionDispatcher.add(CacheAction action)
focal_method.full_signature:  boolean add(CacheAction action)
focal_method.identifier: add
focal_method.invocations: getMemory offer
focal_method.parameters: (CacheAction action)
focal_method.return: boolean
focal_method.signature: boolean add(CacheAction action)