Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-04-18 12:03:47 -0400
committerMichael Valenta2002-04-18 12:03:47 -0400
commitf3e290d3fb62ed87fc0e2dd8daded6f7744016eb (patch)
treeb6fe6516e6591d068a13b565e58de1715f46b262
parent2a6b27bde23b037c1171421afe5eadb76b50d3b4 (diff)
downloadeclipse.platform.team-f3e290d3fb62ed87fc0e2dd8daded6f7744016eb.tar.gz
eclipse.platform.team-f3e290d3fb62ed87fc0e2dd8daded6f7744016eb.tar.xz
eclipse.platform.team-f3e290d3fb62ed87fc0e2dd8daded6f7744016eb.zip
7143: Replacing with stream leads to a problem "Too many files opened"
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java35
1 files changed, 31 insertions, 4 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
index edc118b30..48cfc8749 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
@@ -54,6 +54,8 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
*/
public class RemoteFolderTreeBuilder {
+ private static final int MAX_REVISION_FETCHES_PER_CONNECTION = 1024;
+
private Map fileDeltas;
private List changedFiles;
private Map remoteFolderTable;
@@ -171,8 +173,8 @@ public class RemoteFolderTreeBuilder {
} finally {
session.close();
}
- // FIXME: We need a second session because of the use of a different handle on the same remote resource
- // We didn't need one before!!! Perhaps we could support the changing of a sessions root as long as
+ // We need a second session because of the use of a different handle on the same remote resource
+ // Perhaps we could support the changing of a sessions root as long as
// the folder sync info is the same
remoteRoot =
new RemoteFolderTree(null, root.getName(), repository,
@@ -186,12 +188,37 @@ public class RemoteFolderTreeBuilder {
subProgress.beginTask(null, 512);
// Build the remote tree
buildRemoteTree(session, root, remoteRoot, Path.EMPTY, subProgress);
- if (!changedFiles.isEmpty())
+ // we can only fecth the status for up to 1024 files in a single connection due to
+ // the server which has a limit on the number of "open" files.
+ if (!changedFiles.isEmpty() && changedFiles.size() <= MAX_REVISION_FETCHES_PER_CONNECTION) {
fetchFileRevisions(session, (String[])changedFiles.toArray(new String[changedFiles.size()]), Policy.subMonitorFor(monitor, 20));
- return remoteRoot;
+ }
} finally {
session.close();
}
+
+ // If there were more than 1024 changed files, we need a connection per each 1024
+ if (!changedFiles.isEmpty() && changedFiles.size() > MAX_REVISION_FETCHES_PER_CONNECTION) {
+ String[] allChangedFiles = (String[])changedFiles.toArray(new String[changedFiles.size()]);
+ int iterations = (allChangedFiles.length / MAX_REVISION_FETCHES_PER_CONNECTION)
+ + (allChangedFiles.length % MAX_REVISION_FETCHES_PER_CONNECTION == 0 ? 0 : 1);
+ for (int i = 0; i < iterations ; i++) {
+ int length = Math.min(MAX_REVISION_FETCHES_PER_CONNECTION,
+ allChangedFiles.length - (MAX_REVISION_FETCHES_PER_CONNECTION * i));
+ String buffer[] = new String[length];
+ System.arraycopy(allChangedFiles, i * MAX_REVISION_FETCHES_PER_CONNECTION, buffer, 0, length);
+ session = new Session(repository, remoteRoot, false);
+ session.open(Policy.subMonitorFor(monitor, 1));
+ try {
+ fetchFileRevisions(session, buffer, Policy.subMonitorFor(monitor, 2));
+ } finally {
+ session.close();
+ }
+ }
+ }
+
+ return remoteRoot;
+
} finally {
CVSProviderPlugin.getPlugin().setQuietness(quietness);
monitor.done();

Back to the top