0
後釋放svnkit資源使用
svnkit
在Java應用程序中獲得SVN版本登錄,但完成後的visualVm
一些svnkit資源和線程仍然存在和生活的過程。如何日誌ex。 org.tmatesoft.svn.core.internal.util.SVNHashMap $ KeyIterator,org.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));
我更新了問題,根據文章和更新,我只需調用'repository.closeSession();'釋放資源和連接。 –
你使用什麼協議?如果您使用svn + ssh,SVNKit將SSH連接保持打開狀態約10分鐘,否則所有操作變得非常緩慢。 –
我使用svn並嘗試'repository.closeSession();'但visualVm仍然得到'org.tmatesoft.svn.core.wc.DefaultSVNRepositoryPool $ TimeoutTask' 'org.tmatesoft.svn.core.internal.util.SVNHashMap $ KeyIterator'。 –