Fixes to benchmark application that I forgot to check in.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6957 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-10-10 17:19:24 +00:00
parent 24e809b33b
commit 5d0a520f25
2 changed files with 8 additions and 4 deletions

View File

@@ -30,6 +30,7 @@ import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
/** /**
@@ -75,6 +76,12 @@ public abstract class AbstractLoaderThread extends Thread
this.statCount = 0; this.statCount = 0;
this.statTotalMs = 0.0D; this.statTotalMs = 0.0D;
// Check the load depth
if (this.testLoadDepth < 1 || this.testLoadDepth > this.session.getFolderProfiles().length)
{
throw new AlfrescoRuntimeException("The load depth must be [1," + this.session.getFolderProfiles().length);
}
} }
/** /**
@@ -211,7 +218,7 @@ public abstract class AbstractLoaderThread extends Thread
// We work through these until we get the required depth. // We work through these until we get the required depth.
// The root node is ignored as it acts as the search root // The root node is ignored as it acts as the search root
List<String> path = new ArrayList<String>((int)testLoadDepth); List<String> path = new ArrayList<String>((int)testLoadDepth);
for (int i = 1; i < folderProfiles.length; i++) for (int i = 1; i < testLoadDepth; i++)
{ {
int folderProfile = folderProfiles[i]; int folderProfile = folderProfiles[i];
int randomFolderId = random.nextInt(folderProfile); int randomFolderId = random.nextInt(folderProfile);

View File

@@ -26,7 +26,6 @@ package org.alfresco.repo.model.filefolder.loader;
import java.io.File; import java.io.File;
import java.net.URL; import java.net.URL;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@@ -86,12 +85,10 @@ public class LoaderUploadThread extends AbstractLoaderThread
List<String> folderPath) throws Exception List<String> folderPath) throws Exception
{ {
// Iterate down the path, checking the cache and populating it as necessary // Iterate down the path, checking the cache and populating it as necessary
List<String> currentPath = new ArrayList<String>();
NodeRef currentParentNodeRef = workingRootNodeRef; NodeRef currentParentNodeRef = workingRootNodeRef;
String currentKey = workingRootNodeRef.toString(); String currentKey = workingRootNodeRef.toString();
for (String pathElement : folderPath) for (String pathElement : folderPath)
{ {
currentPath.add(pathElement);
currentKey += ("/" + pathElement); currentKey += ("/" + pathElement);
// Is this there? // Is this there?
NodeRef nodeRef = pathCache.get(currentKey); NodeRef nodeRef = pathCache.get(currentKey);