示例#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();
   }
 }