Package com.attivio.connector
Class ConcurrentDocumentFetcherImpl
- java.lang.Object
-
- com.attivio.connector.ConcurrentDocumentFetcherImpl
-
- All Implemented Interfaces:
ConcurrentScannerDocFetcherState,ConcurrencyProvider,ContentStoreAccess,java.io.Closeable,java.lang.AutoCloseable
public class ConcurrentDocumentFetcherImpl extends java.lang.Object implements ContentStoreAccess, ConcurrencyProvider, ConcurrentScannerDocFetcherState, java.io.Closeable
Provides scanner with the capability to queue document fetchers for concurrent content retrieval and publishing.
-
-
Constructor Summary
Constructors Constructor Description ConcurrentDocumentFetcherImpl(DocumentPublisher publisher, ConcurrentDocumentFetcherScanner scanner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbackOff(long millisBackOffPeriod)Blocks the scanner's ability to queueDocumentFetchRequestrequests for a period of time.voidclose()java.util.Map<ConcurrentScannerDocFetcherTask.TaskState,java.lang.Long>countByState()State: Get the count for eachConcurrentScannerDocFetcherTask.TaskState.voiddoneQueuing()The scanner tells the concurrency provider that it is done queuing tasks.java.util.List<ConcurrentScannerDocFetcherTask.TaskInfo>getFetcherStates(java.util.List<java.lang.String> uids)Get detailedConcurrentScannerDocFetcherTask.TaskInfoinformation for this list of task uuidjava.util.stream.Stream<java.lang.String>getList(ConcurrentScannerDocFetcherTask.TaskState state)Details: Get a stream of task UUID for thisConcurrentScannerDocFetcherTask.TaskStatestate.java.util.Map<ConcurrentScannerTaskExecuter.ConcurrentExecutionMetrics,ConcurrentScannerPerformanceAlert>getPerformanceMetrics()Throughput: Returns the frequency of events over a period of time (e.g over the last 5 minutes).voidput(IngestDocument doc, java.lang.String fieldName, java.lang.String id, java.io.InputStream is)Store the content stream in the content store and put aContentPointerin the indicated document field.booleanqueue(DocumentFetchRequest documentFetcher)Queue a document fetcher for concurrent execution by the connector framework.booleanscannerIsDoneQueuing()Returns true if the scanner told the document fetcher that it's done queuing tasks by calling doneQueuing or by calling stopvoidwaitForOutstandingTasksToFinish()The scanner will use this to wait until all the tasks are executed (or canceled).
-
-
-
Constructor Detail
-
ConcurrentDocumentFetcherImpl
public ConcurrentDocumentFetcherImpl(DocumentPublisher publisher, ConcurrentDocumentFetcherScanner scanner)
-
-
Method Detail
-
backOff
public void backOff(long millisBackOffPeriod)
Description copied from interface:ConcurrencyProviderBlocks the scanner's ability to queueDocumentFetchRequestrequests for a period of time. Used by scanners that honor try-after requests from the server (e.g. the Sharepoint scanner).- Specified by:
backOffin interfaceConcurrencyProvider- Parameters:
millisBackOffPeriod- ignored if not > 0
-
doneQueuing
public void doneQueuing()
Description copied from interface:ConcurrencyProviderThe scanner tells the concurrency provider that it is done queuing tasks. The scanner can be done queuing because all the documents were scanner or becausestopwas called.- Specified by:
doneQueuingin interfaceConcurrencyProvider
-
queue
public boolean queue(DocumentFetchRequest documentFetcher)
Description copied from interface:ConcurrencyProviderQueue a document fetcher for concurrent execution by the connector framework. The call blocks until there is room in the queue.- Specified by:
queuein interfaceConcurrencyProvider- Parameters:
documentFetcher- the document fetch request to queue- Returns:
- true if queued; false if failed to queue. Queuing will fail only if a stop call was issued. Therefore a failure to queue is ok, exception should not be thrown.
-
put
public void put(IngestDocument doc, java.lang.String fieldName, java.lang.String id, java.io.InputStream is) throws AttivioException
Description copied from interface:ContentStoreAccessStore the content stream in the content store and put aContentPointerin the indicated document field.- Specified by:
putin interfaceContentStoreAccess- Parameters:
doc- the Attivio document where theContentPointershould be placed.fieldName- to put theContentPointerin.id- An id to identify the content in the content store. Could be any id that will guarantee uniqueness e.g.UUID.randomUUID().is- the stream of content.- Throws:
AttivioException
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
waitForOutstandingTasksToFinish
public void waitForOutstandingTasksToFinish()
Description copied from interface:ConcurrencyProviderThe scanner will use this to wait until all the tasks are executed (or canceled). A use example: the scanner will wait until all the outstanding document publishing is done before going into a phase of deleting obsolete documents. Note that we don't support a timeout here since tasks should never linger forever if canceled - the connector implementation requires that all the tasks are finished before the connector run is complete.- Specified by:
waitForOutstandingTasksToFinishin interfaceConcurrencyProvider
-
scannerIsDoneQueuing
public boolean scannerIsDoneQueuing()
Description copied from interface:ConcurrentScannerDocFetcherStateReturns true if the scanner told the document fetcher that it's done queuing tasks by calling doneQueuing or by calling stop- Specified by:
scannerIsDoneQueuingin interfaceConcurrentScannerDocFetcherState- Returns:
-
getList
public java.util.stream.Stream<java.lang.String> getList(ConcurrentScannerDocFetcherTask.TaskState state)
Description copied from interface:ConcurrentScannerDocFetcherStateDetails: Get a stream of task UUID for thisConcurrentScannerDocFetcherTask.TaskStatestate.- Specified by:
getListin interfaceConcurrentScannerDocFetcherState- Returns:
- task uuid stream
-
countByState
public java.util.Map<ConcurrentScannerDocFetcherTask.TaskState,java.lang.Long> countByState()
Description copied from interface:ConcurrentScannerDocFetcherStateState: Get the count for eachConcurrentScannerDocFetcherTask.TaskState.- Specified by:
countByStatein interfaceConcurrentScannerDocFetcherState- Returns:
- state count map
-
getPerformanceMetrics
public java.util.Map<ConcurrentScannerTaskExecuter.ConcurrentExecutionMetrics,ConcurrentScannerPerformanceAlert> getPerformanceMetrics()
Description copied from interface:ConcurrentScannerDocFetcherStateThroughput: Returns the frequency of events over a period of time (e.g over the last 5 minutes). Low queuing frequency, for example, could indicate the need to add more work threads.- Specified by:
getPerformanceMetricsin interfaceConcurrentScannerDocFetcherState- Returns:
- frequency map
-
getFetcherStates
public java.util.List<ConcurrentScannerDocFetcherTask.TaskInfo> getFetcherStates(java.util.List<java.lang.String> uids)
Description copied from interface:ConcurrentScannerDocFetcherStateGet detailedConcurrentScannerDocFetcherTask.TaskInfoinformation for this list of task uuid- Specified by:
getFetcherStatesin interfaceConcurrentScannerDocFetcherState- Returns:
- task details
-
-