/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.transport.jms.JmsConnection
 *  com.l7tech.util.Config
 *  com.l7tech.util.ConfigFactory
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.TimeUnit
 *  javax.jms.JMSException
 *  org.springframework.beans.factory.DisposableBean
 */
package com.l7tech.server.transport.jms2;

import com.l7tech.gateway.common.transport.jms.JmsConnection;
import com.l7tech.server.transport.jms.JmsBag;
import com.l7tech.server.transport.jms.JmsRuntimeException;
import com.l7tech.server.transport.jms2.CachedConnection;
import com.l7tech.server.transport.jms2.JmsConnectionMaxWaitException;
import com.l7tech.server.transport.jms2.JmsEndpointConfig;
import com.l7tech.server.transport.jms2.JmsResourceManagerConfig;
import com.l7tech.server.transport.jms2.PooledConnection;
import com.l7tech.server.transport.jms2.SessionHolder;
import com.l7tech.server.transport.jms2.SingleConnection;
import com.l7tech.server.transport.jms2.l;
import com.l7tech.server.util.ManagedTimer;
import com.l7tech.util.Config;
import com.l7tech.util.ConfigFactory;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.TimeUnit;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Collection;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.jms.JMSException;
import javax.naming.Context;
import javax.naming.NamingException;
import org.springframework.beans.factory.DisposableBean;

public class JmsResourceManager
implements DisposableBean,
PropertyChangeListener {
    public static final long DEFAULT_MAXIMUM_AGE = 0L;
    public static final long DEFAULT_MAXIMUM_IDLE_TIME = 0L;
    public static final long DEFAULT_IDLE_TIME = 0L;
    public static final int DEFAULT_MAXIMUM_SIZE = 1;
    public static final int DEFAULT_CONNECTION_POOL_SIZE = 1;
    public static final int DEFAULT_CONNECTION_MIN_IDLE = 1;
    public static final long DEFAULT_CONNECTION_MAX_WAIT = 5000L;
    public static final long DEFAULT_TIME_BETWEEN_EVICTION = 300000L;
    public static final int DEFAULT_EVICTION_BATCH_SIZE = 1;
    public static final int DEFAULT_SESSION_POOL_SIZE = 0;
    public static final int DEFAULT_SESSION_MAX_IDLE = 0;
    public static final long DEFAULT_SESSION_MAX_WAIT = 0L;
    public static final long CONNECTION_MAX_IDLE_RANGE_MIN = 0L;
    public static final long CONNECTION_MAX_IDLE_RANGE_MAX = Long.MAX_VALUE;
    public static final long CONNECTION_IDLE_TIME_RANGE_MIN = 0L;
    public static final long CONNECTION_IDLE_TIME_RANGE_MAX = Long.MAX_VALUE;
    public static final int CONNECTION_POOL_SIZE_RANGE_MIN = 1;
    public static final int CONNECTION_POOL_SIZE_RANGE_MAX = 10000;
    public static final int CONNECTION_MIN_IDLE_RANGE_MIN = 0;
    public static final int CONNECTION_MIN_IDLE_RANGE_MAX = 10000;
    public static final long CONNECTION_POOL_MAX_WAIT_RANGE_MIN = -1L;
    public static final long CONNECTION_POOL_MAX_WAIT_RANGE_MAX = Long.MAX_VALUE;
    public static final long CONNECTION_POOL_EVICT_INTERVAL_RANGE_MIN = 0L;
    public static final long CONNECTION_POOL_EVICT_INTERVAL_RANGE_MAX = Long.MAX_VALUE;
    public static final int EVICTION_BATCH_SIZE_RANGE_MIN = 1;
    public static final int EVICTION_BATCH_SIZE_RANGE_MAX = 10000;
    public static final int SESSION_POOL_SIZE_RANGE_MIN = -1;
    public static final int SESSION_POOL_SIZE_RANGE_MAX = Integer.MAX_VALUE;
    public static final int SESSION_MAX_IDLE_RANGE_MIN = -1;
    public static final int SESSION_MAX_IDLE_RANGE_MAX = Integer.MAX_VALUE;
    public static final long SESSION_MAX_WAIT_RANGE_MIN = -1L;
    public static final long SESSION_MAX_WAIT_RANGE_MAX = Long.MAX_VALUE;
    public static final long CONNECTION_MAX_AGE_RANGE_MIN = 0L;
    public static final long CONNECTION_MAX_AGE_RANGE_MAX = Long.MAX_VALUE;
    public static final int CONNECTION_CACHE_SIZE_RANGE_MIN = 0;
    public static final int CONNECTION_CACHE_SIZE_RANGE_MAX = Integer.MAX_VALUE;
    public static final long DEFAULT_CONNECTION_MAX_AGE;
    public static final long DEFAULT_CONNECTION_MAX_IDLE;
    public static final long DEFAULT_CONNECTION_IDLE_TIME;
    public static final int DEFAULT_CONNECTION_CACHE_SIZE = 100;
    private static final Logger a;
    private static final String b;
    private static final long c;
    private final Config d;
    protected final ConcurrentHashMap<JmsEndpointConfig.JmsEndpointKey, CachedConnection> connectionHolder;
    private final Timer e;
    private final TimerTask f;
    private final AtomicReference<JmsResourceManagerConfig> g = new AtomicReference<JmsResourceManagerConfig>(new JmsResourceManagerConfig(0L, 0L, 0L, 1, 1, 1, 5000L, 300000L, 1, 0, 0, 0L));
    private final AtomicBoolean h = new AtomicBoolean(true);
    private static final String[] i;

    public JmsResourceManager(String string, Config config) {
        this.d = config;
        this.connectionHolder = new ConcurrentHashMap();
        this.e = new ManagedTimer(i[34] + string);
        this.f = new l(this.connectionHolder, this.g);
        this.e.schedule(this.f, 17371L, c);
        this.b();
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    public void doWithJmsResources(JmsEndpointConfig jmsEndpointConfig, JmsResourceCallback jmsResourceCallback) throws NamingException, JMSException, JmsRuntimeException, JmsConnectionMaxWaitException {
        try {
            if (!this.h.get()) {
                throw new JmsRuntimeException(i[19]);
            }
        }
        catch (JmsRuntimeException jmsRuntimeException) {
            throw JmsResourceManager.a(jmsRuntimeException);
        }
        SessionHolder sessionHolder = null;
        try {
            sessionHolder = this.getSessionHolder(jmsEndpointConfig);
            sessionHolder.doWithJmsResources(jmsResourceCallback);
        }
        catch (Throwable throwable) {
            try {
                this.returnSessionHolder(jmsEndpointConfig, sessionHolder);
            }
            catch (JmsRuntimeException jmsRuntimeException) {
                a.log(Level.WARNING, i[15] + String.valueOf(sessionHolder), ExceptionUtils.getDebugException((Throwable)jmsRuntimeException));
            }
            throw throwable;
        }
        try {
            this.returnSessionHolder(jmsEndpointConfig, sessionHolder);
        }
        catch (JmsRuntimeException jmsRuntimeException) {
            String[] stringArray = i;
            a.log(Level.WARNING, stringArray[32] + String.valueOf(sessionHolder), ExceptionUtils.getDebugException((Throwable)jmsRuntimeException));
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Loose catch block
     */
    protected SessionHolder getSessionHolder(JmsEndpointConfig jmsEndpointConfig) throws JmsRuntimeException, JmsConnectionMaxWaitException {
        CachedConnection cachedConnection;
        block13: {
            JmsEndpointConfig.JmsEndpointKey jmsEndpointKey = jmsEndpointConfig.getJmsEndpointKey();
            cachedConnection = this.connectionHolder.get(jmsEndpointKey);
            if (cachedConnection != null) break block13;
            String string = jmsEndpointKey.toString().intern();
            synchronized (string) {
                cachedConnection = this.connectionHolder.get(jmsEndpointKey);
                if (cachedConnection != null) break block13;
                try {
                    JmsResourceManagerConfig jmsResourceManagerConfig;
                    JmsEndpointConfig jmsEndpointConfig2;
                    JmsResourceManager jmsResourceManager;
                    boolean bl2;
                    block12: {
                        block11: {
                            if (jmsEndpointConfig.getEndpoint().isMessageSource()) break block11;
                            try {
                                block14: {
                                    if (!Boolean.valueOf(jmsEndpointConfig.getConnection().properties().getProperty(JmsConnection.PROP_CONNECTION_POOL_ENABLE, Boolean.FALSE.toString())).booleanValue()) break block11;
                                    break block14;
                                    catch (Exception exception) {
                                        throw JmsResourceManager.a(exception);
                                    }
                                }
                                bl2 = true;
                                break block12;
                            }
                            catch (Exception exception) {
                                throw JmsResourceManager.a(exception);
                            }
                        }
                        bl2 = false;
                    }
                    boolean bl3 = bl2;
                    try {
                        jmsResourceManager = this;
                        jmsEndpointConfig2 = jmsEndpointConfig;
                        jmsResourceManagerConfig = bl3 ? this.getAndValidateConnectionPoolClusterProperties() : this.getAndValidateSessionPoolClusterProperties();
                    }
                    catch (Exception exception) {
                        throw JmsResourceManager.a(exception);
                    }
                    cachedConnection = jmsResourceManager.getCachedConnection(jmsEndpointConfig2, jmsResourceManagerConfig, bl3);
                }
                catch (Exception exception) {
                    throw new JmsRuntimeException(exception);
                }
                this.connectionHolder.put(jmsEndpointKey, cachedConnection);
                a.log(Level.FINE, i[20] + cachedConnection.toString());
            }
        }
        return cachedConnection.borrowConnection();
    }

    protected CachedConnection getCachedConnection(JmsEndpointConfig jmsEndpointConfig, JmsResourceManagerConfig jmsResourceManagerConfig, boolean bl2) throws Exception {
        try {
            if (bl2) {
                return new PooledConnection(jmsEndpointConfig, jmsResourceManagerConfig);
            }
        }
        catch (Exception exception) {
            throw JmsResourceManager.a(exception);
        }
        return new SingleConnection(jmsEndpointConfig, jmsResourceManagerConfig);
    }

    protected void returnSessionHolder(JmsEndpointConfig jmsEndpointConfig, SessionHolder sessionHolder) throws JmsRuntimeException {
        block5: {
            try {
                JmsEndpointConfig.JmsEndpointKey jmsEndpointKey;
                block4: {
                    jmsEndpointKey = jmsEndpointConfig.getJmsEndpointKey();
                    CachedConnection cachedConnection = this.connectionHolder.get(jmsEndpointKey);
                    try {
                        if (cachedConnection == null) break block4;
                        cachedConnection.returnConnection(sessionHolder);
                        break block5;
                    }
                    catch (Exception exception) {
                        throw JmsResourceManager.a(exception);
                    }
                }
                String[] stringArray = i;
                a.log(Level.FINE, stringArray[36] + jmsEndpointKey.toString() + stringArray[38]);
            }
            catch (Exception exception) {
                throw new JmsRuntimeException(exception);
            }
        }
    }

    public JmsBag borrowJmsBag(JmsEndpointConfig jmsEndpointConfig) throws NamingException, JmsRuntimeException, JmsConnectionMaxWaitException {
        SessionHolder sessionHolder = this.getSessionHolder(jmsEndpointConfig);
        return sessionHolder.borrowJmsBag();
    }

    public void returnJmsBag(JmsBag jmsBag) throws JmsRuntimeException {
        SessionHolder sessionHolder = (SessionHolder)jmsBag.getBagOwner();
        try {
            if (sessionHolder != null) {
                sessionHolder.returnJmsBag(jmsBag);
                sessionHolder.unRef();
            }
        }
        catch (JmsRuntimeException jmsRuntimeException) {
            throw JmsResourceManager.a(jmsRuntimeException);
        }
    }

    public void touch(JmsBag jmsBag) throws JmsRuntimeException {
        SessionHolder sessionHolder = (SessionHolder)jmsBag.getBagOwner();
        try {
            if (sessionHolder != null) {
                sessionHolder.touch();
            }
        }
        catch (JmsRuntimeException jmsRuntimeException) {
            throw JmsResourceManager.a(jmsRuntimeException);
        }
    }

    public synchronized void invalidate(JmsEndpointConfig jmsEndpointConfig) {
        JmsEndpointConfig.JmsEndpointKey jmsEndpointKey;
        CachedConnection cachedConnection;
        if (this.h.get() && (cachedConnection = this.connectionHolder.get(jmsEndpointKey = jmsEndpointConfig.getJmsEndpointKey())) != null && !cachedConnection.isActive()) {
            a.log(Level.FINE, i[27] + String.valueOf(jmsEndpointKey));
            cachedConnection.close();
            this.connectionHolder.remove(jmsEndpointKey);
        }
    }

    public void destroy() throws Exception {
        try {
            if (this.h.compareAndSet(true, false)) {
                this.a();
            }
        }
        catch (Exception exception) {
            throw JmsResourceManager.a(exception);
        }
    }

    @Override
    public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
        this.b();
    }

    private void a() {
        a.info(i[26]);
        this.e.cancel();
        Collection<CachedConnection> collection = this.connectionHolder.values();
        for (CachedConnection cachedConnection : collection) {
            cachedConnection.close();
        }
        this.connectionHolder.clear();
    }

    public JmsResourceManagerConfig getAndValidateConnectionPoolClusterProperties() {
        String[] stringArray = i;
        long l2 = this.d.getTimeUnitProperty(stringArray[14], DEFAULT_CONNECTION_MAX_IDLE);
        long l3 = this.d.getTimeUnitProperty(stringArray[1], DEFAULT_CONNECTION_IDLE_TIME);
        int n2 = this.d.getIntProperty(stringArray[8], 1);
        int n3 = this.d.getIntProperty(stringArray[31], 0);
        long l4 = this.d.getTimeUnitProperty(stringArray[16], 5000L);
        long l5 = this.d.getTimeUnitProperty(stringArray[12], 10000L);
        int n4 = this.d.getIntProperty(stringArray[0], 1);
        return new JmsResourceManagerConfig(0L, this.a(l2, DEFAULT_CONNECTION_MAX_IDLE, 0L, Long.MAX_VALUE, stringArray[3]), this.a(l3, DEFAULT_CONNECTION_IDLE_TIME, 0L, Long.MAX_VALUE, stringArray[25]), 0, this.a(n2, 1, 1, 10000, stringArray[30]), this.a(n3, 1, 0, 10000, stringArray[9]), this.a(l4, 5000L, -1L, Long.MAX_VALUE, stringArray[11]), this.a(l5, 10000L, 0L, Long.MAX_VALUE, stringArray[2]), this.a(n4, 1, 1, 10000, stringArray[35]), 0, 0, 0L);
    }

    public JmsResourceManagerConfig getAndValidateSessionPoolClusterProperties() {
        String[] stringArray = i;
        long l2 = this.d.getTimeUnitProperty(stringArray[28], DEFAULT_CONNECTION_MAX_IDLE);
        int n2 = this.d.getIntProperty(stringArray[17], 8);
        int n3 = this.d.getIntProperty(stringArray[4], 8);
        long l3 = this.d.getTimeUnitProperty(stringArray[13], 5000L);
        return new JmsResourceManagerConfig(0L, this.a(l2, DEFAULT_CONNECTION_MAX_IDLE, 0L, Long.MAX_VALUE, stringArray[39]), 0L, 0, 0, 0, 0L, 0L, 0, this.a(n2, 8, -1, Integer.MAX_VALUE, stringArray[10]), this.a(n3, 8, -1, Integer.MAX_VALUE, stringArray[22]), this.a(l3, 5000L, -1L, Long.MAX_VALUE, stringArray[37]));
    }

    private void b() {
        String[] stringArray = i;
        a.config(stringArray[7]);
        long l2 = this.d.getTimeUnitProperty(stringArray[6], DEFAULT_CONNECTION_MAX_AGE);
        long l3 = this.d.getTimeUnitProperty(stringArray[28], DEFAULT_CONNECTION_MAX_IDLE);
        int n2 = this.d.getIntProperty(stringArray[24], 100);
        this.g.set(new JmsResourceManagerConfig(this.a(l2, DEFAULT_CONNECTION_MAX_AGE, 0L, Long.MAX_VALUE, stringArray[23]), this.a(l3, DEFAULT_CONNECTION_MAX_IDLE, 0L, Long.MAX_VALUE, stringArray[39]), this.a(n2, 100, 0, Integer.MAX_VALUE, stringArray[21])));
    }

    private <T extends Number> T a(T t2, T t3, T t4, T t5, String string) {
        T t6;
        if (t2.longValue() < t4.longValue()) {
            String[] stringArray = i;
            a.log(Level.WARNING, stringArray[18], new Object[]{string, t2, t4, t3});
            t6 = t3;
        } else if (t2.longValue() > t5.longValue()) {
            a.log(Level.WARNING, i[29], new Object[]{string, t2, t5, t3});
            t6 = t3;
        } else {
            t6 = t2;
        }
        return t6;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[40];
                var3_1 = 0;
                var2_2 = "DD'x{}rCE\bv|WrCn\u001b|kJtBE/t|]u~B\u0017p\u0017DD'x{}rCE\bv|WrCb\tymjt@N)gf>5KQsCN\u000eaaQs\r{\u0002zd\u001eIDF\b5J[iZN\b{({kDH\u0019|gP\u001bgf>5KQsCN\u000eaaQs\rf\fmaSh@\u000b$qd[\u0013DD'x{mx^X\u0004zfs|Ub\tym2ND\u0000;d\tiHH\u0005;{[o[N\u001f;|L|CX\u001dzzJ3GF\u001e;k_~EN.ym_sdE\u0019pzH|A\u001aDD'x{}rCE\bv|WrCh\fv`[PLS,rm \u0005y\b<dQ|IB\u0003r(]|NC\b5kQsKB\n`z_iDD\u0003;\u0017DD'x{}rCE\bv|WrC{\u0002zdmtWN\u0017gf>5KQsCN\u000eaaQs\rf\u0004{(wyAN\u0015gf>5[[n^B\u0002{(nrBGMFaDx\u001bgf>5KQsCN\u000eaaQs\rf\fmaSh@\u000b:taJ\"DD'x{}rCE\bv|WrC\u007f\u0004xm|xY\\\bpf{kDH\u0019|gP\u0013DD'x{mx^X\u0004zfs|U|\f||\u001fDD'x{}rCE\bv|WrCh\fv`[PLS$qd[IDF\b#xE\fwd[=YDMgmJh_EMvi]uHOMvgPsHH\u0019|gP=\u0016DD'x{}rCE\bv|WrCf\fm__tY\u0014DD'x{mx^X\u0004zfnrBG>|r[WnD\u0003saYh_J\u0019|gP=[J\u0001`m\u001e{BYMn8C=DXM|fH|AB\t5 E,P\u000b\u0000|fWpXFM|{\u001ef\u001fVD9(KnDE\n5l[{L^\u0001a(H|A^\b5 E.P\u0002C gf>5z[nB^\u001fvm\u001epLE\frmL=DXMf|Qm]N\t;\u001dnY\bt|[y\rE\bb(}|NC\bqKQsCN\u000eaaQs\r\u0019gf>5KQsCN\u000eaaQs\rh\fv`[=~B\u0017p\u0014gf>5[[n^B\u0002{(s|U\u000b$qd[\u001agf>5KQsCN\u000eaaQs\rf\fmaSh@\u000b,rm\u0018DD'x{}rCE\bv|WrCh\fv`[NDQ\b\u001agf>5XQrA\u000b>znJ=dO\u0001p(jt@N\u0002`|#~C\u0018a|WsJ\u000b\tz\u007fP=gf>5KQsCN\u000eaaQs\rH\fv`[3#\u007fN\u0000z~WsJ\u000b.tkVxIh\u0002{f[~YB\u0002{(ItYCM~mG=\u001fDD'x{}rCE\bv|WrCh\fv`[PLS$qd[IDF\bWnD\u0003saYh_J\u0019|gP=[J\u0001`m\u001e{BYMn8C=DXM|fH|AB\t5 E,P\u000b\u0000tpWpXFM|{\u001ef\u001fVD9(KnDE\n5l[{L^\u0001a(H|A^\b5 E.P\u0002C\u0018gf>5KQsCN\u000eaaQs\r{\u0002zd\u001eNDQ\b\u0016DD'x{}rCE\bv|WrCf\u0004{AZqH#xE\fwd[=YDMgmJh_EMvi]uHOMvgPsHH\u0019|gP=2ND\u0000;d\tiHH\u0005;{[o[N\u001f;|L|CX\u001dzzJ3GF\u001e;k_~EN.ym_sdE\u0019pzH|A gF\u001eGmMrXY\u000epE_sLL\bg%}|NC\bVd[|C^\u001d8\"gf>5KQsCN\u000eaaQs\rn\u001b|kJtBEMWiJ~E\u000b>|r[\u001cgf>5KQsCN\u000eaaQs\r\\\u0004a`\u001eiENM~mG=\u0014gf>5[[n^B\u0002{(s|U\u000b:taJ";
                var4_3 = "DD'x{}rCE\bv|WrCn\u001b|kJtBE/t|]u~B\u0017p\u0017DD'x{}rCE\bv|WrCb\tymjt@N)gf>5KQsCN\u000eaaQs\r{\u0002zd\u001eIDF\b5J[iZN\b{({kDH\u0019|gP\u001bgf>5KQsCN\u000eaaQs\rf\fmaSh@\u000b$qd[\u0013DD'x{mx^X\u0004zfs|Ub\tym2ND\u0000;d\tiHH\u0005;{[o[N\u001f;|L|CX\u001dzzJ3GF\u001e;k_~EN.ym_sdE\u0019pzH|A\u001aDD'x{}rCE\bv|WrCh\fv`[PLS,rm \u0005y\b<dQ|IB\u0003r(]|NC\b5kQsKB\n`z_iDD\u0003;\u0017DD'x{}rCE\bv|WrC{\u0002zdmtWN\u0017gf>5KQsCN\u000eaaQs\rf\u0004{(wyAN\u0015gf>5[[n^B\u0002{(nrBGMFaDx\u001bgf>5KQsCN\u000eaaQs\rf\fmaSh@\u000b:taJ\"DD'x{}rCE\bv|WrC\u007f\u0004xm|xY\\\bpf{kDH\u0019|gP\u0013DD'x{mx^X\u0004zfs|U|\f||\u001fDD'x{}rCE\bv|WrCh\fv`[PLS$qd[IDF\b#xE\fwd[=YDMgmJh_EMvi]uHOMvgPsHH\u0019|gP=\u0016DD'x{}rCE\bv|WrCf\fm__tY\u0014DD'x{mx^X\u0004zfnrBG>|r[WnD\u0003saYh_J\u0019|gP=[J\u0001`m\u001e{BYMn8C=DXM|fH|AB\t5 E,P\u000b\u0000|fWpXFM|{\u001ef\u001fVD9(KnDE\n5l[{L^\u0001a(H|A^\b5 E.P\u0002C gf>5z[nB^\u001fvm\u001epLE\frmL=DXMf|Qm]N\t;\u001dnY\bt|[y\rE\bb(}|NC\bqKQsCN\u000eaaQs\r\u0019gf>5KQsCN\u000eaaQs\rh\fv`[=~B\u0017p\u0014gf>5[[n^B\u0002{(s|U\u000b$qd[\u001agf>5KQsCN\u000eaaQs\rf\fmaSh@\u000b,rm\u0018DD'x{}rCE\bv|WrCh\fv`[NDQ\b\u001agf>5XQrA\u000b>znJ=dO\u0001p(jt@N\u0002`|#~C\u0018a|WsJ\u000b\tz\u007fP=gf>5KQsCN\u000eaaQs\rH\fv`[3#\u007fN\u0000z~WsJ\u000b.tkVxIh\u0002{f[~YB\u0002{(ItYCM~mG=\u001fDD'x{}rCE\bv|WrCh\fv`[PLS$qd[IDF\bWnD\u0003saYh_J\u0019|gP=[J\u0001`m\u001e{BYMn8C=DXM|fH|AB\t5 E,P\u000b\u0000tpWpXFM|{\u001ef\u001fVD9(KnDE\n5l[{L^\u0001a(H|A^\b5 E.P\u0002C\u0018gf>5KQsCN\u000eaaQs\r{\u0002zd\u001eNDQ\b\u0016DD'x{}rCE\bv|WrCf\u0004{AZqH#xE\fwd[=YDMgmJh_EMvi]uHOMvgPsHH\u0019|gP=2ND\u0000;d\tiHH\u0005;{[o[N\u001f;|L|CX\u001dzzJ3GF\u001e;k_~EN.ym_sdE\u0019pzH|A gF\u001eGmMrXY\u000epE_sLL\bg%}|NC\bVd[|C^\u001d8\"gf>5KQsCN\u000eaaQs\rn\u001b|kJtBEMWiJ~E\u000b>|r[\u001cgf>5KQsCN\u000eaaQs\r\\\u0004a`\u001eiENM~mG=\u0014gf>5[[n^B\u0002{(s|U\u000b:taJ".length();
                var1_4 = 32;
                var0_5 = -1;
lbl7:
                // 2 sources

                while (true) {
                    v0 = 117;
                    v1 = ++var0_5;
                    v2 = var2_2.substring(v1, v1 + var1_4);
                    v3 = -1;
                    break block9;
                    break;
                }
lbl13:
                // 1 sources

                while (true) {
                    var5[var3_1++] = JmsResourceManager.a(v0, JmsResourceManager.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "s1|\u000e\u0005`\r<!3\u000e\u000e)\u0010'{\u001b\u0019\u0018@K5/\r=0p\u001f\u001f/\rs\u0018r\u0013\u001f-\u0016>uZ\u000f\u001a%";
                    var4_3 = "s1|\u000e\u0005`\r<!3\u000e\u000e)\u0010'{\u001b\u0019\u0018@K5/\r=0p\u001f\u001f/\rs\u0018r\u0013\u001f-\u0016>uZ\u000f\u001a%".length();
                    var1_4 = 16;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 11;
                        v4 = ++var0_5;
                        v2 = var2_2.substring(v4, v4 + var1_4);
                        v3 = 0;
                        break block9;
                        break;
                    }
                    break;
                }
lbl28:
                // 1 sources

                while (true) {
                    var5[var3_1++] = JmsResourceManager.a(v0, JmsResourceManager.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    break block10;
                    break;
                }
            }
            switch (v3) {
                default: {
                    ** continue;
                }
                ** case 0:
lbl39:
                // 1 sources

                ** continue;
            }
        }
        JmsResourceManager.i = var5;
        JmsResourceManager.b = JmsResourceManager.i[33];
        JmsResourceManager.DEFAULT_CONNECTION_MAX_AGE = TimeUnit.MINUTES.toMillis(30L);
        JmsResourceManager.DEFAULT_CONNECTION_MAX_IDLE = TimeUnit.MINUTES.toMillis(5L);
        JmsResourceManager.DEFAULT_CONNECTION_IDLE_TIME = TimeUnit.MINUTES.toMillis(2L);
        JmsResourceManager.a = Logger.getLogger(JmsResourceManager.class.getName());
        JmsResourceManager.c = ConfigFactory.getLongProperty((String)JmsResourceManager.i[5], (long)27937L);
    }

    private static Exception a(Exception exception) {
        return exception;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x68);
        }
        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 -> 88;
                    case 1 -> 94;
                    case 2 -> 24;
                    case 3 -> 96;
                    case 4 -> 125;
                    case 5 -> 75;
                    default -> 104;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }

    public static interface JmsResourceCallback {
        public void doWork(JmsBag var1, JndiContextProvider var2) throws JMSException;
    }

    public static interface JndiContextCallback {
        public void doWork(Context var1) throws NamingException;
    }

    public static interface JndiContextProvider {
        public void doWithJndiContext(JndiContextCallback var1) throws NamingException;

        public Object lookup(String var1) throws NamingException;
    }
}

