我正在制作一个程序,将我的存储库(或我的仓库的特定目录/文件)的内容导出到指定服务器上的目录中。我有基本的功能,但问题是速度。对于所有文件,我对这些导出的平均测试时间为193秒,而在linux shell中自己运行命令只需要大约6秒钟。我接近这个的方式有什么不对吗?
private boolean stageItems(SVNRepository repository, SVNUpdateClient
updateClient, String server,
String version, ObservableList<String> items) throws SVNException {
boolean success = false;
long totalDuration = 0;
String baseUrlPath = "http://" + repository.getLocation().getHost() + repository.getLocation().getPath()
+ "/branches/versions/" + version;
Iterator<String> itemItr = items.iterator();
while (itemItr.hasNext()) {
long startTime = System.nanoTime() / 1000000;
String item = itemItr.next();
String fullPath = baseUrlPath + "/" + item;
SVNURL url = SVNURL.parseURIEncoded(fullPath);
SVNNodeKind nodeKind = repository.checkPath("/branches/versions/" + version + "/" + item, -1);
File destPath = new File("\\\\" + server + "\\u1\\pyle\\team\\moy\\bbjstaging\\" + item);
if (nodeKind == SVNNodeKind.DIR) {
long l = updateClient.doExport(url, destPath, SVNRevision.HEAD,
SVNRevision.HEAD, null, true, SVNDepth.INFINITY);
} else {
long l = updateClient.doExport(url, destPath, SVNRevision.HEAD,
SVNRevision.HEAD, null, true, SVNDepth.EMPTY);
}
}
return success;
}