test_class.file: dataprep-backend-service/src/test/java/org/talend/dataprep/util/ReentrantReadWriteLockGroupTest.java
test_class.identifier: ReentrantReadWriteLockGroupTest
test_case.body: @Test
      public void ensure_that_two_different_lock_are_returned_when_threshold_is_reached() {
          // given
          ReentrantReadWriteLockGroup locks = new ReentrantReadWriteLockGroup(true, 1);
  
          // when
          ReentrantReadWriteLock firstLockForOneValue = locks.getLock("1");
          Runnable runnable = new Runnable() {
  
              @Override
              public void run() {
                  firstLockForOneValue.writeLock().lock();
              }
          };
          Thread t = new Thread(runnable);
          t.start();
          try {
              t.join();
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
          ReentrantReadWriteLock firstLockForTwoValue = locks.getLock("2");
          ReentrantReadWriteLock secondLockForOneValue = locks.getLock("1");
  
          // then
          assertEquals(firstLockForOneValue, secondLockForOneValue);
      }
test_case.class_method_signature: ReentrantReadWriteLockGroupTest.ensure_that_two_different_lock_are_returned_when_threshold_is_reached()
test_case.full_signature: @Test public void ensure_that_two_different_lock_are_returned_when_threshold_is_reached()
test_case.identifier: ensure_that_two_different_lock_are_returned_when_threshold_is_reached
test_case.invocations: getLock lock writeLock start join printStackTrace getLock getLock assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void ensure_that_two_different_lock_are_returned_when_threshold_is_reached()
focal_class.declarator: fairness
focal_class.modifier: private final
focal_class.original_string: private final boolean fairness;
focal_class.type: boolean
focal_class.var_name: fairness
focal_class.declarator: CLEANUP_THRESHOLD
focal_class.modifier: private final
focal_class.original_string: private final int CLEANUP_THRESHOLD;
focal_class.type: int
focal_class.var_name: CLEANUP_THRESHOLD
focal_class.declarator: counter = 0
focal_class.modifier: private
focal_class.original_string: private int counter = 0;
focal_class.type: int
focal_class.var_name: counter
focal_class.declarator: locks = new ConcurrentHashMap<>()
focal_class.modifier: private
focal_class.original_string: private ConcurrentHashMap<String, ReentrantReadWriteLock> locks = new ConcurrentHashMap<>();
focal_class.type: ConcurrentHashMap<String, ReentrantReadWriteLock>
focal_class.var_name: locks
focal_class.file: dataprep-backend-service/src/main/java/org/talend/dataprep/util/ReentrantReadWriteLockGroup.java
focal_class.identifier: ReentrantReadWriteLockGroup
focal_class.class_method_signature: ReentrantReadWriteLockGroup.ReentrantReadWriteLockGroup()
focal_class.full_signature: public  ReentrantReadWriteLockGroup()
focal_class.identifier: ReentrantReadWriteLockGroup
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  ReentrantReadWriteLockGroup()
focal_class.class_method_signature: ReentrantReadWriteLockGroup.ReentrantReadWriteLockGroup(int counter)
focal_class.full_signature: public  ReentrantReadWriteLockGroup(int counter)
focal_class.identifier: ReentrantReadWriteLockGroup
focal_class.modifiers: public
focal_class.parameters: (int counter)
focal_class.signature:  ReentrantReadWriteLockGroup(int counter)
focal_class.class_method_signature: ReentrantReadWriteLockGroup.ReentrantReadWriteLockGroup(boolean fairness)
focal_class.full_signature: public  ReentrantReadWriteLockGroup(boolean fairness)
focal_class.identifier: ReentrantReadWriteLockGroup
focal_class.modifiers: public
focal_class.parameters: (boolean fairness)
focal_class.signature:  ReentrantReadWriteLockGroup(boolean fairness)
focal_class.class_method_signature: ReentrantReadWriteLockGroup.ReentrantReadWriteLockGroup(boolean fairness, int counter)
focal_class.full_signature: public  ReentrantReadWriteLockGroup(boolean fairness, int counter)
focal_class.identifier: ReentrantReadWriteLockGroup
focal_class.modifiers: public
focal_class.parameters: (boolean fairness, int counter)
focal_class.signature:  ReentrantReadWriteLockGroup(boolean fairness, int counter)
focal_class.class_method_signature: ReentrantReadWriteLockGroup.getLock(String id)
focal_class.full_signature: public ReentrantReadWriteLock getLock(String id)
focal_class.identifier: getLock
focal_class.modifiers: public
focal_class.parameters: (String id)
focal_class.return: ReentrantReadWriteLock
focal_class.signature: ReentrantReadWriteLock getLock(String id)
focal_class.class_method_signature: ReentrantReadWriteLockGroup.cleanUp(ReentrantReadWriteLock doNotRemove)
focal_class.full_signature: private void cleanUp(ReentrantReadWriteLock doNotRemove)
focal_class.identifier: cleanUp
focal_class.modifiers: private
focal_class.parameters: (ReentrantReadWriteLock doNotRemove)
focal_class.return: void
focal_class.signature: void cleanUp(ReentrantReadWriteLock doNotRemove)
focal_class.class_method_signature: ReentrantReadWriteLockGroup.lockHeldOrAsked(ReentrantReadWriteLock lock)
focal_class.full_signature: private boolean lockHeldOrAsked(ReentrantReadWriteLock lock)
focal_class.identifier: lockHeldOrAsked
focal_class.modifiers: private
focal_class.parameters: (ReentrantReadWriteLock lock)
focal_class.return: boolean
focal_class.signature: boolean lockHeldOrAsked(ReentrantReadWriteLock lock)
focal_method.body: public ReentrantReadWriteLock getLock(String id) {
          ReentrantReadWriteLock lock = locks.get(id);
          if (lock == null) {
              locks.putIfAbsent(id, new ReentrantReadWriteLock(fairness));
          }
          lock = locks.get(id);
  
          if (CLEANUP_THRESHOLD <= ++counter) {
              cleanUp(lock);
              counter = 0;
          }
          return lock;
      }
focal_method.class_method_signature: ReentrantReadWriteLockGroup.getLock(String id)
focal_method.full_signature: public ReentrantReadWriteLock getLock(String id)
focal_method.identifier: getLock
focal_method.invocations: get putIfAbsent get cleanUp
focal_method.modifiers: public
focal_method.parameters: (String id)
focal_method.return: ReentrantReadWriteLock
focal_method.signature: ReentrantReadWriteLock getLock(String id)