@ Nonnull private EChange _queueUniqueWorkItem ( @ Nonnull final IIndexerWorkItem aWorkItem ) { ValueEnforcer . notNull ( aWorkItem , "WorkItem" ) ; // Check for duplicate m_aRWLock . writeLock ( ) . lock ( ) ; try { if ( ! m_aUniqueItems . add ( aWorkItem ) ) { LOGGER . info ( "Ignoring work item " + aWorkItem . getLogText ( ) + " because it is already in the queue/re-index list!" ) ; return EChange . UNCHANGED ; } } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } // Queue it m_aIndexerWorkQueue . queueObject ( aWorkItem ) ; LOGGER . info ( "Queued work item " + aWorkItem . getLogText ( ) ) ; // Remove the entry from the dead list to avoid spamming the dead list if ( m_aDeadList . getAndRemoveEntry ( x -> x . getWorkItem ( ) . equals ( aWorkItem ) ) != null ) LOGGER . info ( "Removed the new work item " + aWorkItem . getLogText ( ) + " from the dead list" ) ; return EChange . CHANGED ; }
Queue a single work item of any type . If the item is already in the queue it is ignored .