MNT-16709 : Metadata extraction on 200MB PDF file causes large heap utilization

- added concurrent extraction limit
   - added max document size limit

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@131709 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andreea Dragoi
2016-10-24 12:13:50 +00:00
parent 2b4db66fbe
commit c95cbaccd9
8 changed files with 282 additions and 94 deletions

View File

@@ -29,15 +29,17 @@ import org.alfresco.api.AlfrescoPublicApi;
/**
* Represents maximum values (that result in exceptions if exceeded) or
* limits on values (that result in EOF (End Of File) being returned
* early). The only current option is for elapsed time.
* limits on values (that result in EOF (End Of File) being returned early).
* The current options are elapsed time, document size and concurrent extractions limit.
*
* @author Ray Gauss II
*/
@AlfrescoPublicApi
public class MetadataExtracterLimits
{
private long timeoutMs = -1;
private long timeoutMs = Long.MAX_VALUE;
private double maxDocumentSizeMB = Double.MAX_VALUE;
private int maxConcurrentExtractionsCount = Integer.MAX_VALUE;
/**
* Gets the time in milliseconds after which the metadata extracter will be stopped.
@@ -57,6 +59,44 @@ public class MetadataExtracterLimits
public void setTimeoutMs(long timeoutMs)
{
this.timeoutMs = timeoutMs;
}
/**
* Gets the maximum size(MB) allowed for a transformation
*
* @return maximum size
*/
public double getMaxDocumentSizeMB()
{
return maxDocumentSizeMB;
}
/**
* Sets the maximum size(MB) allowed for a transformation
*
* @param maxDocumentSizeMB
*/
public void setMaxDocumentSizeMB(double maxDocumentSizeMB)
{
this.maxDocumentSizeMB = maxDocumentSizeMB;
}
/**
* Sets the maximum number of allowed concurrent extractions
*
* @param maxConcurrentExtractionsCount
*/
public void setMaxConcurrentExtractionsCount(int maxConcurrentExtractionsCount)
{
this.maxConcurrentExtractionsCount = maxConcurrentExtractionsCount;
}
/**
* Gets the maximum count of allowed concurrent extractions
*
* @return maximum count
*/
public int getMaxConcurrentExtractionsCount()
{
return maxConcurrentExtractionsCount;
}
}