core/src/main/java/com/orientechnologies/common/collection/closabledictionary/OClosableLinkedContainer.java
private void checkOpenFilesLimit() throws InterruptedException {
    CountDownLatch ol = openLatch.get();
    if (ol != null)
      ol.await();

    while (openFiles.get() > openLimit) {
      final CountDownLatch latch = new CountDownLatch(1);

      //make other threads to wait till we evict entries and close evicted open files
      if (openLatch.compareAndSet(null, latch)) {
        while (openFiles.get() > openLimit) {
          emptyBuffers();
        }

        latch.countDown();
        openLatch.set(null);
      } else {
        ol = openLatch.get();

        if (ol != null)
          ol.await();
      }
    }
  }
private void checkOpenFilesLimit() throws InterruptedException {
    CountDownLatch ol = openLatch.get();
    if (ol != null)
      ol.await();

    while (openFiles.get() > openLimit) {
      final CountDownLatch latch = new CountDownLatch(1);

      //make other threads to wait till we evict entries and close evicted open files
      if (openLatch.compareAndSet(null, latch)) {
        while (openFiles.get() > openLimit) {
          emptyBuffers();
        }

        latch.countDown();
        openLatch.set(null);
      } else {
        ol = openLatch.get();

        if (ol != null)
          ol.await();
      }
    }
  }
private void checkOpenFilesLimit ( ) throws InterruptedException { CountDownLatch ol = openLatch . get ( ) ; if ( ol != null ) ol . await ( ) ; while ( openFiles . get ( ) > openLimit ) { final CountDownLatch latch = new CountDownLatch ( 1 ) ; //make other threads to wait till we evict entries and close evicted open files if ( openLatch . compareAndSet ( null , latch ) ) { while ( openFiles . get ( ) > openLimit ) { emptyBuffers ( ) ; } latch . countDown ( ) ; openLatch . set ( null ) ; } else { ol = openLatch . get ( ) ; if ( ol != null ) ol . await ( ) ; } } }
Checks if containers limit of open files is reached.
<p>
In such case execution of threads which add or acquire items is stopped and they wait till buffers will be emptied
and nubmer of open files will be inside limit.
Checks if containers limit of open files is reached . <p > In such case execution of threads which add or acquire items is stopped and they wait till buffers will be emptied and nubmer of open files will be inside limit .