Class AsynchronousAuditor

  • All Implemented Interfaces:
    IAuditor

    @ThreadSafe
    public class AsynchronousAuditor
    extends AbstractAuditor
    The class handles audit items asynchronously. If a new audit item is to be handled it is put into the IConcurrentPerformer's queue as provided in the constructor.
    Please ensure to call stop() if this auditor is no longer used, so that the created ExecutorService can be gracefully shutdown.
    Author:
    Philip Helger
    • Constructor Detail

      • AsynchronousAuditor

        public AsynchronousAuditor​(@Nonnull
                                   com.helger.security.authentication.subject.user.ICurrentUserIDProvider aUserIDProvider,
                                   @Nonnull
                                   com.helger.commons.concurrent.collector.IConcurrentPerformer<List<IAuditItem>> aPerformer)
    • Method Detail

      • stop

        @Nonnull
        public com.helger.commons.state.EChange stop()
        When using this auditor, it is important to call this stop() method before shutdown. It avoids further queuing of objects and waits until all items are handled. This method blocks until all remaining objects are handled.
        Returns:
        EChange.CHANGED if the shutdown was performed, EChange.UNCHANGED if the auditor was already shut down.