Package com.suse.coco.attestation
Class AttestationQueueProcessor
- java.lang.Object
-
- com.suse.coco.attestation.AttestationQueueProcessor
-
public class AttestationQueueProcessor extends java.lang.ObjectProcess entry in the table suseAttestationResult and executes the proper based on the result type.
-
-
Field Summary
Fields Modifier and Type Field Description private ListeningThreadlisteningThreadprivate ProcessingThreadprocessingThread
-
Constructor Summary
Constructors Modifier Constructor Description protectedAttestationQueueProcessor(javax.sql.DataSource dataSource, AttestationResultService service, java.util.concurrent.ExecutorService executorService, AttestationModuleLoader moduleLoader, int batchSize)Create an attestation queue processor.AttestationQueueProcessor(org.apache.ibatis.session.SqlSessionFactory sessionFactory, Configuration configuration, AttestationModuleLoader moduleLoader)Create an attestation queue processor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawaitTermination()Wait indefinitely for the processor to complete.booleanisRunning()Check if this attestation processor is runningvoidstart()Start the execution of the queue processor.voidstop()Interrupts the execution of this processor.
-
-
-
Field Detail
-
listeningThread
private final ListeningThread listeningThread
-
processingThread
private final ProcessingThread processingThread
-
-
Constructor Detail
-
AttestationQueueProcessor
public AttestationQueueProcessor(org.apache.ibatis.session.SqlSessionFactory sessionFactory, Configuration configuration, AttestationModuleLoader moduleLoader)Create an attestation queue processor.- Parameters:
sessionFactory- the session factory to access the databaseconfiguration- the current application configurationmoduleLoader- the attestation module loader
-
AttestationQueueProcessor
protected AttestationQueueProcessor(javax.sql.DataSource dataSource, AttestationResultService service, java.util.concurrent.ExecutorService executorService, AttestationModuleLoader moduleLoader, int batchSize)Create an attestation queue processor.- Parameters:
dataSource- the datasource to be used to listen to the database notificationservice- the attestation result serviceexecutorService- the executor to perform the processmoduleLoader- the attestation module loaderbatchSize- the batch size
-
-
Method Detail
-
start
public void start()
Start the execution of the queue processor. This method will start the processing asynchronously and exit immediately. UseawaitTermination()to wait for the processor to complete.
-
awaitTermination
public void awaitTermination() throws java.lang.InterruptedExceptionWait indefinitely for the processor to complete. This is the same as awaitTermination(0L)- Throws:
java.lang.InterruptedException- if the wait for all the threads to stop is interrupted
-
stop
public void stop()
Interrupts the execution of this processor.
-
isRunning
public boolean isRunning()
Check if this attestation processor is running- Returns:
- true if at least one of the processor threads is still running
-
-