@ SuppressWarnings ( "squid:S3516" ) private Void executeAutoCleanup ( ) { systemManagement . forEachTenant ( tenant -> cleanupTasks . forEach ( task -> { final Lock lock = obtainLock ( task , tenant ) ; if ( ! lock . tryLock ( ) ) { return ; } try { task . run ( ) ; } catch ( final RuntimeException e ) { LOGGER . error ( "Cleanup task failed." , e ) ; } finally { lock . unlock ( ) ; } } ) ) ; return null ; }
Method which executes each registered cleanup task for each tenant .