<commit_before>/**
 * <NAME> - A.M.:3070130
 * <NAME> - A.M.:3070175
 *
 * check LICENSE.txt in the parent directory
 *
 * The MIT License
 *
 * Copyright (c) 2009 <NAME> and <NAME>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package networking;

import chord.Node;
import chord.RemoteNode;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 *@author <NAME> and <NAME>
 */
public class RMIRegistry {

    private static boolean init = false;
    private static Registry registry;

    static public boolean init()
    {
        if(init)
        {
            return init;
        }
        try
        {
            RMIRegistry.registry = LocateRegistry.getRegistry();
        }
        catch (RemoteException ex)
        {
            Logger.getLogger(RMIRegistry.class.getName()).log(Level.SEVERE, null, ex);
        }
        return init=true;
    }<commit_msg>some usefull comments were added<commit_after>/**
 * <NAME> - A.M.:3070130
 * Chatzipetros Mike - A.M.:3070175
 *
 * check LICENSE.txt in the parent directory
 *
 * The MIT License
 *
 * Copyright (c) 2009 <NAME> and <NAME>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package networking;

import chord.Node;
import chord.RemoteNode;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 *@author <NAME> and <NAME>
 */
public class RMIRegistry {

    private static boolean init = false;
    private static Registry registry;

    /*
     * This method works like java RMI tutorial example
     * http://java.sun.com/docs/books/tutorial/rmi/overview.html
     * and as the example we have to start RMI registry before the
     * execution of our applications.
     * It is start rmiregistry fow windows (or javaw if start not available)
     * and rmiregistry & for linux.
     * We also use a security manager, so we need to specify a security policy
     * file so that the code is granted the security permissions it needs to run.
     */
    static public boolean init()
    {
        if(init)
        {
            return init;
        }
        if (System.getSecurityManager() == null)
        {
            System.setSecurityManager(new SecurityManager());
        }

        try
        {
            RMIRegistry.registry = LocateRegistry.getRegistry();
        }
        catch (RemoteException ex)
        {
            Logger.getLogger(RMIRegistry.class.getName()).log(Level.SEVERE, null, ex);
        }
        return init=true;
    }
{'fraction_non_alphanumeric': 0.07806999378753365, 'fraction_numerical': 0.00745495961896873, 'mean_word_length': 3.1176470588235294, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, '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': '4612105', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1260, 'n_words': 547}