/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  javax.jms.JMSException
 */
package com.l7tech.server.transport.jms2;

import com.l7tech.server.transport.jms.JmsBag;
import com.l7tech.server.transport.jms.JmsConfigException;
import com.l7tech.server.transport.jms.JmsRuntimeException;
import com.l7tech.server.transport.jms2.JmsEndpointConfig;
import com.l7tech.server.transport.jms2.SessionHolderBase;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.jms.JMSException;
import javax.naming.NamingException;

public class NonCachedSessionHolder
extends SessionHolderBase {
    private static final Logger e;
    private static final String[] f;

    protected NonCachedSessionHolder(JmsEndpointConfig jmsEndpointConfig, JmsBag jmsBag) {
        super(jmsEndpointConfig, jmsBag);
    }

    @Override
    public JmsBag borrowJmsBag() throws JmsRuntimeException, NamingException {
        this.touch();
        try {
            e.log(Level.FINE, f[2]);
            return this.makeJmsBag();
        }
        catch (JMSException jMSException) {
            throw new JmsRuntimeException(jMSException);
        }
        catch (NamingException namingException) {
            throw namingException;
        }
        catch (JmsConfigException jmsConfigException) {
            throw new JmsRuntimeException(jmsConfigException);
        }
        catch (Exception exception) {
            throw new JmsRuntimeException(exception);
        }
    }

    @Override
    public void returnJmsBag(JmsBag jmsBag) {
        e.log(Level.FINE, f[0]);
        jmsBag.closeSession();
    }

    @Override
    public void close() {
        e.log(Level.FINE, f[1], new Object[]{this.name, this.connectionVersion, this.endpointVersion});
        this.bag.close();
        this.referenceCount.set(0);
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[3];
        int n2 = 0;
        String string = "BoM+hPt1zQ7m\u001fsb*\u000ev!|v~yW6f\u001fP\\Y\u001e\u000bdLixePv-RfQ+hQ}1@s\u000b!\\u\u007fd[;uVu\u007f*\u0016#1B3=*H=sLs~d\u001e#0B j8C,BoM+hPt1zQ7m\u001fsb*\u000ev!|htkJ1oX:\u007foIxKrI1Y[+rVu\u007f$";
        int n3 = "BoM+hPt1zQ7m\u001fsb*\u000ev!|v~yW6f\u001fP\\Y\u001e\u000bdLixePv-RfQ+hQ}1@s\u000b!\\u\u007fd[;uVu\u007f*\u0016#1B3=*H=sLs~d\u001e#0B j8C,BoM+hPt1zQ7m\u001fsb*\u000ev!|htkJ1oX:\u007foIxKrI1Y[+rVu\u007f$".length();
        int n4 = 39;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = NonCachedSessionHolder.b(11, NonCachedSessionHolder.b(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                f = stringArray;
                e = Logger.getLogger(NonCachedSessionHolder.class.getName());
                return;
            }
            n4 = string.charAt(n5);
        }
    }

    private static char[] b(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x11);
        }
        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 -> 26;
                    case 1 -> 1;
                    case 2 -> 53;
                    case 3 -> 83;
                    case 4 -> 10;
                    case 5 -> 52;
                    default -> 17;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

