Search in sources :

Example 1 with StandardLineageResult

use of org.apache.nifi.provenance.StandardLineageResult in project nifi by apache.

the class LuceneEventIndex method purgeObsoleteQueries.

private void purgeObsoleteQueries() {
    try {
        final Date now = new Date();
        final Iterator<Map.Entry<String, AsyncQuerySubmission>> queryIterator = querySubmissionMap.entrySet().iterator();
        while (queryIterator.hasNext()) {
            final Map.Entry<String, AsyncQuerySubmission> entry = queryIterator.next();
            final StandardQueryResult result = entry.getValue().getResult();
            if (entry.getValue().isCanceled() || result.isFinished() && result.getExpiration().before(now)) {
                queryIterator.remove();
            }
        }
        final Iterator<Map.Entry<String, AsyncLineageSubmission>> lineageIterator = lineageSubmissionMap.entrySet().iterator();
        while (lineageIterator.hasNext()) {
            final Map.Entry<String, AsyncLineageSubmission> entry = lineageIterator.next();
            final StandardLineageResult result = entry.getValue().getResult();
            if (entry.getValue().isCanceled() || result.isFinished() && result.getExpiration().before(now)) {
                lineageIterator.remove();
            }
        }
    } catch (final Exception e) {
        logger.error("Failed to expire Provenance Query Results due to {}", e.toString());
        logger.error("", e);
    }
}
Also used : AsyncQuerySubmission(org.apache.nifi.provenance.AsyncQuerySubmission) Date(java.util.Date) AsyncLineageSubmission(org.apache.nifi.provenance.AsyncLineageSubmission) AccessDeniedException(org.apache.nifi.authorization.AccessDeniedException) IOException(java.io.IOException) StandardLineageResult(org.apache.nifi.provenance.StandardLineageResult) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap) StandardQueryResult(org.apache.nifi.provenance.StandardQueryResult)

Aggregations

IOException (java.io.IOException)1 Date (java.util.Date)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 AccessDeniedException (org.apache.nifi.authorization.AccessDeniedException)1 AsyncLineageSubmission (org.apache.nifi.provenance.AsyncLineageSubmission)1 AsyncQuerySubmission (org.apache.nifi.provenance.AsyncQuerySubmission)1 StandardLineageResult (org.apache.nifi.provenance.StandardLineageResult)1 StandardQueryResult (org.apache.nifi.provenance.StandardQueryResult)1