<commit_before>package org.jboss.cx.remoting;

import java.io.IOException;
import java.net.SocketAddress;
import java.util.concurrent.ConcurrentMap;
import org.jboss.cx.remoting.core.CoreEndpoint;
import org.jboss.cx.remoting.core.protocol.LocalProtocolHandlerFactory;
import org.jboss.cx.remoting.jrpp.JrppProtocolSupport;
import org.jboss.cx.remoting.jrpp.JrppServer;
import org.jboss.cx.remoting.log.Logger;
import org.jboss.cx.remoting.util.AttributeMap;

/**
 *
 */
public final class Remoting {
    private static final Logger log = Logger.getLogger(Remoting.class);

    private static final String JRPP_SUPPORT_KEY = "org.jboss.cx.remoting.standalone.jrpp.support";

    // lifecycle lock
    private static final Object lifecycle = new Object();

    public static <I, O> Endpoint createEndpoint(String name) throws IOException {
        synchronized (lifecycle) {
            boolean ok = false;
            final CoreEndpoint coreEndpoint = new CoreEndpoint();
            coreEndpoint.setName(name);
            coreEndpoint.create();
            try {
                coreEndpoint.start();
                try {
                    LocalProtocolHandlerFactory.addTo(coreEndpoint);
                    final JrppProtocolSupport jrppProtocolSupport = new JrppProtocolSupport();
                    jrppProtocolSupport.setEndpoint(coreEndpoint);
                    jrppProtocolSupport.create();
                    try {
                        jrppProtocolSupport.start();
                        try {
                            final ConcurrentMap<Object, Object> attributes = coreEndpoint.getAttributes();
                            attributes.put(JRPP_SUPPORT_KEY, jrppProtocolSupport);
                            ok = true;
                            return coreEndpoint;
                        } finally {
                            if (! ok) {
                                jrppProtocolSupport.stop();
                            }
                        }
                    } finally {
                        if (! ok) {
                            jrppProtocolSupport.destroy();
                        }<commit_msg>Minor cleanups<commit_after>package org.jboss.cx.remoting;

import java.io.IOException;
import java.net.SocketAddress;
import java.util.concurrent.ConcurrentMap;
import org.jboss.cx.remoting.core.CoreEndpoint;
import org.jboss.cx.remoting.core.protocol.LocalProtocolHandlerFactory;
import org.jboss.cx.remoting.jrpp.JrppProtocolSupport;
import org.jboss.cx.remoting.jrpp.JrppServer;
import org.jboss.cx.remoting.util.AttributeMap;

/**
 *
 */
public final class Remoting {
    private static final String JRPP_SUPPORT_KEY = "org.jboss.cx.remoting.standalone.jrpp.support";

    // lifecycle lock
    private static final Object lifecycle = new Object();

    public static Endpoint createEndpoint(String name) throws IOException {
        synchronized (lifecycle) {
            boolean ok = false;
            final CoreEndpoint coreEndpoint = new CoreEndpoint();
            coreEndpoint.setName(name);
            coreEndpoint.create();
            try {
                coreEndpoint.start();
                try {
                    LocalProtocolHandlerFactory.addTo(coreEndpoint);
                    final JrppProtocolSupport jrppProtocolSupport = new JrppProtocolSupport();
                    jrppProtocolSupport.setEndpoint(coreEndpoint);
                    jrppProtocolSupport.create();
                    try {
                        jrppProtocolSupport.start();
                        try {
                            final ConcurrentMap<Object, Object> attributes = coreEndpoint.getAttributes();
                            attributes.put(JRPP_SUPPORT_KEY, jrppProtocolSupport);
                            ok = true;
                            return coreEndpoint;
                        } finally {
                            if (! ok) {
                                jrppProtocolSupport.stop();
                            }
                        }
                    } finally {
                        if (! ok) {
                            jrppProtocolSupport.destroy();
                        }
{'fraction_non_alphanumeric': 0.07922450933460987, 'fraction_numerical': 0.0, 'mean_word_length': 1.6102435977514054, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1370672', 'n_tokens_mistral': 1039, 'n_tokens_neox': 987, 'n_words': 189}