/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.cluster.ServiceUsage
 *  com.l7tech.util.ExceptionUtils
 *  org.hibernate.HibernateException
 *  org.springframework.context.ApplicationContext
 *  org.springframework.orm.hibernate5.HibernateCallback
 *  org.springframework.orm.hibernate5.HibernateTemplate
 *  org.springframework.transaction.PlatformTransactionManager
 *  org.springframework.transaction.TransactionStatus
 *  org.springframework.transaction.support.TransactionTemplate
 */
package com.l7tech.server.cluster;

import com.l7tech.gateway.common.cluster.ServiceUsage;
import com.l7tech.server.cluster.MysqlServiceUsageManager;
import com.l7tech.server.cluster.s;
import com.l7tech.server.util.ManagedTimerTask;
import com.l7tech.util.ExceptionUtils;
import java.util.List;
import java.util.logging.Level;
import org.hibernate.HibernateException;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate5.HibernateCallback;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionTemplate;

class aa
extends ManagedTimerTask {
    private final ApplicationContext c;
    private TransactionTemplate d;
    private HibernateTemplate e;
    private final String f;
    final MysqlServiceUsageManager this$0;
    private static final String g = aa.b(33, aa.b("&a\u0004/~&&\nzQ1\u007fe'\u0017jQ0\u007ft>\fm\u0014cou)\u0002k"));

    private aa(MysqlServiceUsageManager mysqlServiceUsageManager, ApplicationContext applicationContext, HibernateTemplate hibernateTemplate, PlatformTransactionManager platformTransactionManager, String string) {
        this.this$0 = mysqlServiceUsageManager;
        this.c = applicationContext;
        this.e = hibernateTemplate;
        this.f = string;
        this.d = new TransactionTemplate(platformTransactionManager);
        this.d.setReadOnly(false);
    }

    @Override
    protected void doRun() {
        this.a();
    }

    private void a() {
        List<ServiceUsage> list = this.this$0.getServiceUsageFromCache(this.f);
        this.record(list);
    }

    public void record(List<ServiceUsage> list) {
        try {
            this.d.execute(arg_0 -> this.lambda$record$0(list, arg_0));
        }
        catch (HibernateException hibernateException) {
            MysqlServiceUsageManager.a.log(Level.SEVERE, g, ExceptionUtils.getDebugException((Throwable)hibernateException));
        }
    }

    private Object lambda$record$0(List list, TransactionStatus transactionStatus) {
        return this.e.execute((HibernateCallback)new s(this, list));
    }

    private static char[] b(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x69);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String b(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 68;
                    case 1 -> 47;
                    case 2 -> 80;
                    case 3 -> 98;
                    case 4 -> 59;
                    case 5 -> 39;
                    default -> 105;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

