public void cleanUserNamesTimer()

in java/ws-server/src/main/java/com/epam/deltix/tbwg/webapp/services/oid/UserInfoServiceImpl.java [45:80]


    public void cleanUserNamesTimer() {
        long st = System.nanoTime();

        try {
            long now = System.currentTimeMillis();

            synchronized (sync) {
                long it = cachedSub.getFirst();
                while (it != ObjToObjHashMap.NO_ELEMENT) {
                    final Sub userName = cachedSub.getValueAt(it);
                    if (userName.getExpiration() < now) {
                        it = cachedSub.removeAt(it);
                    } else {
                        it = cachedSub.getNext(it);
                    }
                }

                it = cachedUserNames.getFirst();
                while (it != ObjToObjHashMap.NO_ELEMENT) {
                    final UserName userName = cachedUserNames.getValueAt(it);
                    if (userName.getExpiration() < now) {
                        it = cachedUserNames.removeAt(it);
                    } else {
                        it = cachedUserNames.getNext(it);
                    }
                }
            }
        } catch (Throwable ex) {
            LOG.error().append("Unexpected exception in cleanUserNamesTimer: ").append(ex).commit();
        } finally {
            long et = System.nanoTime();
            if (et - st > keepAliveTimerThresholdNs) {
                LOG.warn().append("cleanUserNamesTimer took too much time to execute: ").append((et - st) / 1_000_000_000.0).append("s").commit();
            }
        }
    }