org.eclipse.jgit.lib.Repository.doClose()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中org.eclipse.jgit.lib.Repository.doClose方法的一些代码示例,展示了Repository.doClose的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.doClose方法的具体详情如下:
包路径:org.eclipse.jgit.lib.Repository
类名称:Repository
方法名:doClose

Repository.doClose介绍

[英]Invoked when the use count drops to zero during #close().

The default implementation closes the object and ref databases.
[中]在#close()期间使用计数降至零时调用。
默认实现关闭对象和引用数据库。

代码示例

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

private void unregisterAndCloseRepository(Key location) {
  synchronized (lockFor(location)) {
    Repository oldDb = unregisterRepository(location);
    if (oldDb != null) {
      oldDb.doClose();
    }
  }
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * {@inheritDoc}
 * <p>
 * Decrement the use count, and maybe close resources.
 */
@Override
public void close() {
  int newCount = useCnt.decrementAndGet();
  if (newCount == 0) {
    if (RepositoryCache.isCached(this)) {
      closedAt.set(System.currentTimeMillis());
    } else {
      doClose();
    }
  } else if (newCount == -1) {
    // should not happen, only log when useCnt became negative to
    // minimize number of log entries
    String message = MessageFormat.format(JGitText.get().corruptUseCnt,
        toString());
    if (LOG.isDebugEnabled()) {
      LOG.debug(message, new IllegalStateException());
    } else {
      LOG.warn(message);
    }
    if (RepositoryCache.isCached(this)) {
      closedAt.set(System.currentTimeMillis());
    }
  }
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

private void unregisterAndCloseRepository(final Key location,
    Repository db) {
  synchronized (lockFor(location)) {
    Repository oldDb = unregisterRepository(location);
    if (oldDb != null) {
      oldDb.doClose();
    }
  }
}

代码示例来源:origin: berlam/github-bucket

private void unregisterAndCloseRepository(Key location) {
  synchronized (lockFor(location)) {
    Repository oldDb = unregisterRepository(location);
    if (oldDb != null) {
      oldDb.doClose();
    }
  }
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

/** Decrement the use count, and maybe close resources. */
public void close() {
  int newCount = useCnt.decrementAndGet();
  if (newCount == 0) {
    if (RepositoryCache.isCached(this)) {
      closedAt.set(System.currentTimeMillis());
    } else {
      doClose();
    }
  } else if (newCount == -1) {
    // should not happen, only log when useCnt became negative to
    // minimize number of log entries
    if (LOG.isDebugEnabled()) {
      IllegalStateException e = new IllegalStateException();
      LOG.debug(JGitText.get().corruptUseCnt, e);
    } else {
      LOG.warn(JGitText.get().corruptUseCnt);
    }
    if (RepositoryCache.isCached(this)) {
      closedAt.set(System.currentTimeMillis());
    }
  }
}

代码示例来源:origin: berlam/github-bucket

/**
 * {@inheritDoc}
 * <p>
 * Decrement the use count, and maybe close resources.
 */
@Override
public void close() {
  int newCount = useCnt.decrementAndGet();
  if (newCount == 0) {
    if (RepositoryCache.isCached(this)) {
      closedAt.set(System.currentTimeMillis());
    } else {
      doClose();
    }
  } else if (newCount == -1) {
    // should not happen, only log when useCnt became negative to
    // minimize number of log entries
    String message = MessageFormat.format(JGitText.get().corruptUseCnt,
        toString());
    if (LOG.isDebugEnabled()) {
      LOG.debug(message, new IllegalStateException());
    } else {
      LOG.warn(message);
    }
    if (RepositoryCache.isCached(this)) {
      closedAt.set(System.currentTimeMillis());
    }
  }
}

相关文章

Repository类方法