/**
* @throws DataSetException In case any it doesn't meet the thresholds set.
*/
public void validate() throws Exception {
DataSet dataSet = dataSetRef.get();
DataProvider dataProvider = dataSet.getDataProvider();
if (dataProvider == null) return;
MemoryProfiler memoryProfiler = MemoryProfiler.lookup().freeMemory();
long memoryUsed = memoryProfiler.getMemoryUsedInBytes() - startMemory;
long elapsedTime = System.currentTimeMillis() - startTime;
long sizeInBytes = dataSet.sizeOf();
long maxSize = dataProvider.getDataLoader().getMaxDataSetSizeInBytes();
long maxTime = dataProvider.getDataLoader().getMaxDataSetLoadTimeInMillis();
long maxMemUsed = dataProvider.getDataLoader().getMaxMemoryUsedInDataLoad();
if (maxMemUsed > 0 && memoryUsed > maxMemUsed) {
String total = MemoryProfiler.formatSize(maxMemUsed);
throw new DataSetException("Data set load memory usage has been exceeded = " + total);
}