2013-05-21 82 views
0
  • 後釋放svnkit資源使用svnkit在Java應用程序中獲得SVN版本登錄,但完成後的visualVm一些svnkit資源和線程仍然存在和生活的過程。如何日誌

  • ex。 org.tmatesoft.svn.core.internal.util.SVNHashMap $ KeyIteratororg.tmatesoft.svn.core.wc.DefaultSVNRepositoryPool $ TimeoutTask

  • ,當我嘗試登錄不止一次它的影響應用性能。

  • 我該如何釋放svnkit資源?

  • 代碼示例:

    public static SVNLogEntryHandler doLogFully(String[] paths, long startRevision, long endRevision, SVNRepository repository) throws SVNException { 
    SVNLogEntryHandler logEntryHandler = new SVNLogEntryHandler(); 
    
    repository.log(paths, startRevision, endRevision, true, true, 0, false, null, logEntryHandler); 
    
    return logEntryHandler; 
    } 
    
  • 故事日誌條目。

    for (SVNLogEntry logEntry : doLogFully(..,..,..,..,..).getLogEntries()) { 
        // store log entry 
        } 
    
  • 更新

    • 我使用SVNRepositoryFactory創建SVNRepository

      SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(repositoryUrl)); 
          repository.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager(repositoryUserName, repositoryPassword)); 
      

回答

0

運行ISVNRepositoryPool#處置從中創建SVNRepository實例的連接池。它會停止計時器。

另請參閱此article用於釋放SVNKit資源。

+0

我更新了問題,根據文章和更新,我只需調用'repository.closeSession();'釋放資源和連接。 –

+0

你使用什麼協議?如果您使用svn + ssh,SVNKit將SSH連接保持打開狀態約10分鐘,否則所有操作變得非常緩慢。 –

+0

我使用svn並嘗試'repository.closeSession();'但visualVm仍然得到'org.tmatesoft.svn.core.wc.DefaultSVNRepositoryPool $ TimeoutTask' 'org.tmatesoft.svn.core.internal.util.SVNHashMap $ KeyIterator'。 –