@RetryingTest(2)
    void verifyConcurrentCleaner() throws Throwable {
        val registryTask = new TimerTask() {
            @Override
            public void run() {
                for (var i = 0; i < 5; i++) {
                    FunctionUtils.doUnchecked(__ -> {
                        val tgt = new TicketGrantingTicketImpl(TicketGrantingTicket.PREFIX + '-' + RandomUtils.randomAlphabetic(16),
                            CoreAuthenticationTestUtils.getAuthentication(UUID.randomUUID().toString()),
                            new HardTimeoutExpirationPolicy(1));
                        ticketRegistry.addTicket(tgt);

                        val st = tgt.grantServiceTicket(
                            ServiceTicket.PREFIX + '-' + RandomUtils.randomAlphabetic(16), RegisteredServiceTestUtils.getService(),
                            new HardTimeoutExpirationPolicy(1), true, serviceTicketSessionTrackingPolicy);
                        ticketRegistry.addTicket(st);
                        ticketRegistry.updateTicket(tgt);
                    });
                }
            }
        };
        val registryTimer = new Timer("TicketRegistry");
        registryTimer.scheduleAtFixedRate(registryTask, 5, 5);


        val cleanerTask = new TimerTask() {
            @Override
            public void run() {
                ticketRegistryCleaner.clean();
            }
        };
        val cleanerTimer = new Timer("TicketRegistryCleanerTimer");
        cleanerTimer.scheduleAtFixedRate(cleanerTask, 10, 5);

        Thread.sleep(1000 * 15);
        cleanerTimer.cancel();
        registryTimer.cancel();
        ticketRegistry.deleteAll();
    }
This is {@link BaseJpaTicketRegistryCleanerTests}.

@author Misagh Moayyed
@since 6.0.0
support/cas-server-support-jpa-ticket-registry/src/test/java/org/apereo/cas/ticket/registry/cleaner/BaseJpaTicketRegistryCleanerTests.java