예제 #1
0
파일: Log.java 프로젝트: AbacusHu/OpenDJ
 /**
  * Release a reference to the log corresponding to provided path. The log is closed if this is the
  * last reference.
  */
 private static synchronized void releaseLog(final File logPath) {
   Log<?, ?> log = logsCache.get(logPath);
   if (log == null) {
     // this should never happen
     logger.error(ERR_CHANGELOG_UNREFERENCED_LOG_WHILE_RELEASING.get(logPath.getPath()));
     return;
   }
   if (log.referenceCount > 1) {
     log.referenceCount--;
   } else {
     log.doClose();
     logsCache.remove(logPath);
   }
 }
예제 #2
0
파일: Log.java 프로젝트: AbacusHu/OpenDJ
 @Override
 public void close() {
   log.sharedLock.lock();
   try {
     delegate.close();
     log.unregisterCursor(this);
   } finally {
     log.sharedLock.unlock();
   }
 }
예제 #3
0
파일: Log.java 프로젝트: AbacusHu/OpenDJ
 @Override
 public boolean positionTo(
     final K key,
     final KeyMatchingStrategy matchStrategy,
     final PositionStrategy positionStrategy)
     throws ChangelogException {
   final LogFile<K, V> logFile = log.findLogFileFor(key);
   if (logFile != currentLogFile) {
     switchToLogFile(logFile);
   }
   return (key == null) ? true : currentCursor.positionTo(key, matchStrategy, positionStrategy);
 }
예제 #4
0
파일: Log.java 프로젝트: AbacusHu/OpenDJ
 @Override
 public boolean next() throws ChangelogException {
   final boolean hasNext = currentCursor.next();
   if (hasNext) {
     return true;
   }
   final LogFile<K, V> logFile = log.getNextLogFile(currentLogFile);
   if (logFile != null) {
     switchToLogFile(logFile);
     return currentCursor.next();
   }
   return false;
 }
예제 #5
0
파일: Log.java 프로젝트: AbacusHu/OpenDJ
 @Override
 public boolean next() throws ChangelogException {
   log.sharedLock.lock();
   try {
     if (mustAbort) {
       delegate.close();
       delegate = new AbortedLogCursor<>(log.getPath());
       mustAbort = false;
     }
     return delegate.next();
   } finally {
     log.sharedLock.unlock();
   }
 }