mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -41,9 +41,9 @@ public abstract class AbstractLoaderThread extends Thread
|
|||||||
{
|
{
|
||||||
protected final LoaderSession session;
|
protected final LoaderSession session;
|
||||||
protected final String loaderName;
|
protected final String loaderName;
|
||||||
protected final int testPeriod;
|
protected final long testPeriod;
|
||||||
protected final int testTotal;
|
protected final long testTotal;
|
||||||
protected final int testLoadDepth;
|
protected final long testLoadDepth;
|
||||||
|
|
||||||
private AtomicBoolean mustStop;
|
private AtomicBoolean mustStop;
|
||||||
private Random random;
|
private Random random;
|
||||||
@@ -56,9 +56,9 @@ public abstract class AbstractLoaderThread extends Thread
|
|||||||
public AbstractLoaderThread(
|
public AbstractLoaderThread(
|
||||||
LoaderSession session,
|
LoaderSession session,
|
||||||
String loaderName,
|
String loaderName,
|
||||||
int testPeriod,
|
long testPeriod,
|
||||||
int testTotal,
|
long testTotal,
|
||||||
int testLoadDepth)
|
long testLoadDepth)
|
||||||
{
|
{
|
||||||
super(LoaderSession.THREAD_GROUP, "LoaderThread-" + loaderName);
|
super(LoaderSession.THREAD_GROUP, "LoaderThread-" + loaderName);
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ public abstract class AbstractLoaderThread extends Thread
|
|||||||
|
|
||||||
// Do we wait or continue immediately
|
// Do we wait or continue immediately
|
||||||
long duration = endTime - startTime;
|
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)
|
if (mustWait >= 5)
|
||||||
{
|
{
|
||||||
synchronized(this)
|
synchronized(this)
|
||||||
@@ -190,7 +190,7 @@ public abstract class AbstractLoaderThread extends Thread
|
|||||||
int[] folderProfiles = session.getFolderProfiles();
|
int[] folderProfiles = session.getFolderProfiles();
|
||||||
// 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>(testLoadDepth);
|
List<String> path = new ArrayList<String>((int)testLoadDepth);
|
||||||
for (int i = 1; i < folderProfiles.length; i++)
|
for (int i = 1; i < folderProfiles.length; i++)
|
||||||
{
|
{
|
||||||
int folderProfile = folderProfiles[i];
|
int folderProfile = folderProfiles[i];
|
||||||
|
@@ -263,7 +263,7 @@ public class FileFolderRemoteLoader
|
|||||||
String valuesStr = properties.getProperty(propertyName);
|
String valuesStr = properties.getProperty(propertyName);
|
||||||
FileFolderRemoteLoader.checkProperty(propertyName, valuesStr);
|
FileFolderRemoteLoader.checkProperty(propertyName, valuesStr);
|
||||||
// Parse it into the well-known values
|
// 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;
|
int index = 0;
|
||||||
StringTokenizer tokenizer = new StringTokenizer(valuesStr, ",");
|
StringTokenizer tokenizer = new StringTokenizer(valuesStr, ",");
|
||||||
while (tokenizer.hasMoreTokens())
|
while (tokenizer.hasMoreTokens())
|
||||||
@@ -276,10 +276,10 @@ public class FileFolderRemoteLoader
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int testCount = values[0];
|
long testCount = values[0];
|
||||||
int testPeriod = values[1];
|
long testPeriod = values[1];
|
||||||
int testTotal = values[2];
|
long testTotal = values[2];
|
||||||
int testDepth = values[3];
|
long testDepth = values[3];
|
||||||
|
|
||||||
// Construct
|
// Construct
|
||||||
for (int i = 0; i < testCount; i++)
|
for (int i = 0; i < testCount; i++)
|
||||||
|
@@ -42,9 +42,9 @@ public class LoaderListFoldersThread extends AbstractLoaderThread
|
|||||||
public LoaderListFoldersThread(
|
public LoaderListFoldersThread(
|
||||||
LoaderSession session,
|
LoaderSession session,
|
||||||
String loaderName,
|
String loaderName,
|
||||||
int testPeriod,
|
long testPeriod,
|
||||||
int testTotal,
|
long testTotal,
|
||||||
int testLoadDepth)
|
long testLoadDepth)
|
||||||
{
|
{
|
||||||
super(session, loaderName, testPeriod, testTotal, testLoadDepth);
|
super(session, loaderName, testPeriod, testTotal, testLoadDepth);
|
||||||
}
|
}
|
||||||
|
@@ -38,9 +38,9 @@ public class LoaderTotalsThread extends AbstractLoaderThread
|
|||||||
public LoaderTotalsThread(
|
public LoaderTotalsThread(
|
||||||
LoaderSession session,
|
LoaderSession session,
|
||||||
String loaderName,
|
String loaderName,
|
||||||
int testPeriod,
|
long testPeriod,
|
||||||
int testTotal,
|
long testTotal,
|
||||||
int testLoadDepth)
|
long testLoadDepth)
|
||||||
{
|
{
|
||||||
super(session, loaderName, testPeriod, testTotal, testLoadDepth);
|
super(session, loaderName, testPeriod, testTotal, testLoadDepth);
|
||||||
}
|
}
|
||||||
|
@@ -61,9 +61,9 @@ public class LoaderUploadThread extends AbstractLoaderThread
|
|||||||
public LoaderUploadThread(
|
public LoaderUploadThread(
|
||||||
LoaderSession session,
|
LoaderSession session,
|
||||||
String loaderName,
|
String loaderName,
|
||||||
int testPeriod,
|
long testPeriod,
|
||||||
int testTotal,
|
long testTotal,
|
||||||
int testLoadDepth)
|
long testLoadDepth)
|
||||||
{
|
{
|
||||||
super(session, loaderName, testPeriod, testTotal, testLoadDepth);
|
super(session, loaderName, testPeriod, testTotal, testLoadDepth);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user