/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  org.springframework.transaction.TransactionStatus
 *  org.springframework.transaction.support.TransactionCallback
 */
package com.l7tech.server.cluster;

import com.l7tech.server.cluster.ClusterMasterImpl;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;

class i
implements TransactionCallback<Boolean> {
    final ClusterMasterImpl.MasterCheckTask this$0;
    private static final String a = i.a(110, i.a("W\u00120k27)y\u001f6l# \u0015[\u001a "));

    i(ClusterMasterImpl.MasterCheckTask masterCheckTask) {
        this.this$0 = masterCheckTask;
    }

    public Boolean doInTransaction(TransactionStatus transactionStatus) {
        Boolean bl2 = null;
        String string = this.this$0.a.getProperty(a);
        if (string != null && !string.isEmpty()) {
            this.this$0.d.set(this.this$0.e.equals(string));
        } else {
            ClusterMasterImpl.MasterCheckTask.MasterInfo masterInfo = this.this$0.getMasterInfo();
            boolean bl3 = this.this$0.e.equals(masterInfo.getMasterNodeId());
            this.this$0.d.set(bl3);
            if (bl3) {
                if (!this.this$0.updateMasterTimestamp(masterInfo.getVersion())) {
                    this.this$0.d.set(this.this$0.e.equals(this.this$0.getMasterInfo().getMasterNodeId()));
                }
            } else if (this.this$0.isMasterStale(masterInfo.getTimestamp())) {
                bl2 = this.this$0.becomeMaster(masterInfo.getVersion());
            }
        }
        return bl2;
    }

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(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 -> 90;
                    case 1 -> 16;
                    case 2 -> 43;
                    case 3 -> 118;
                    case 4 -> 40;
                    case 5 -> 60;
                    default -> 53;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

