Allow test delays to be expressed in milliseconds

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6810 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-18 05:44:59 +00:00
parent 2d3984edea
commit bd4bb4f640
5 changed files with 22 additions and 22 deletions

View File

@@ -41,9 +41,9 @@ public abstract class AbstractLoaderThread extends Thread
{
protected final LoaderSession session;
protected final String loaderName;
protected final int testPeriod;
protected final int testTotal;
protected final int testLoadDepth;
protected final long testPeriod;
protected final long testTotal;
protected final long testLoadDepth;
private AtomicBoolean mustStop;
private Random random;
@@ -56,9 +56,9 @@ public abstract class AbstractLoaderThread extends Thread
public AbstractLoaderThread(
LoaderSession session,
String loaderName,
int testPeriod,
int testTotal,
int testLoadDepth)
long testPeriod,
long testTotal,
long testLoadDepth)
{
super(LoaderSession.THREAD_GROUP, "LoaderThread-" + loaderName);
@@ -138,7 +138,7 @@ public abstract class AbstractLoaderThread extends Thread
// Do we wait or continue immediately
long duration = endTime - startTime;
long mustWait = (testPeriod * 1000L) - (long)(duration / 1000.0 / 1000.0);
long mustWait = testPeriod - (long)(duration / 1000.0 / 1000.0);
if (mustWait >= 5)
{
synchronized(this)
@@ -190,7 +190,7 @@ public abstract class AbstractLoaderThread extends Thread
int[] folderProfiles = session.getFolderProfiles();
// We work through these until we get the required depth.
// The root node is ignored as it acts as the search root
List<String> path = new ArrayList<String>(testLoadDepth);
List<String> path = new ArrayList<String>((int)testLoadDepth);
for (int i = 1; i < folderProfiles.length; i++)
{
int folderProfile = folderProfiles[i];

View File

@@ -263,7 +263,7 @@ public class FileFolderRemoteLoader
String valuesStr = properties.getProperty(propertyName);
FileFolderRemoteLoader.checkProperty(propertyName, valuesStr);
// Parse it into the well-known values
int[] values = new int[] {1, 0, -1, 1};
long[] values = new long[] {1, 0, -1, 1};
int index = 0;
StringTokenizer tokenizer = new StringTokenizer(valuesStr, ",");
while (tokenizer.hasMoreTokens())
@@ -276,10 +276,10 @@ public class FileFolderRemoteLoader
break;
}
}
int testCount = values[0];
int testPeriod = values[1];
int testTotal = values[2];
int testDepth = values[3];
long testCount = values[0];
long testPeriod = values[1];
long testTotal = values[2];
long testDepth = values[3];
// Construct
for (int i = 0; i < testCount; i++)

View File

@@ -42,9 +42,9 @@ public class LoaderListFoldersThread extends AbstractLoaderThread
public LoaderListFoldersThread(
LoaderSession session,
String loaderName,
int testPeriod,
int testTotal,
int testLoadDepth)
long testPeriod,
long testTotal,
long testLoadDepth)
{
super(session, loaderName, testPeriod, testTotal, testLoadDepth);
}

View File

@@ -38,9 +38,9 @@ public class LoaderTotalsThread extends AbstractLoaderThread
public LoaderTotalsThread(
LoaderSession session,
String loaderName,
int testPeriod,
int testTotal,
int testLoadDepth)
long testPeriod,
long testTotal,
long testLoadDepth)
{
super(session, loaderName, testPeriod, testTotal, testLoadDepth);
}

View File

@@ -61,9 +61,9 @@ public class LoaderUploadThread extends AbstractLoaderThread
public LoaderUploadThread(
LoaderSession session,
String loaderName,
int testPeriod,
int testTotal,
int testLoadDepth)
long testPeriod,
long testTotal,
long testLoadDepth)
{
super(session, loaderName, testPeriod, testTotal, testLoadDepth);
}