<commit_before>/*
 * ################################################################
 *
 * ProActive: The Java(TM) library for Parallel, Distributed,
 *            Concurrent computing with Security and Mobility
 *
 * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
 * Contact: <EMAIL>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 *  Initial developer(s):               The ProActive Team
 *                        http://proactive.inria.fr/team_members.htm
 *  Contributor(s):
 *
 * ################################################################
 */
package org.objectweb.proactive.api;

import java.io.IOException;
import java.lang.reflect.Array;
import java.net.URI;
import java.util.Vector;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import org.apache.log4j.Logger;
import org.objectweb.proactive.Active;
import org.objectweb.proactive.ActiveObjectCreationException;
import org.objectweb.proactive.Body;
import org.objectweb.proactive.annotation.PublicAPI;
import org.objectweb.proactive.benchmarks.timit.util.basic.TimItBasicManager;
import org.objectweb.proactive.core.ProActiveException;
import org.objectweb.proactive.core.ProActiveRuntimeException;
import org.objectweb.proactive.core.body.AbstractBody;
import org.objectweb.proactive.core.body.Context;
import org.objectweb.proactive.core.body.HalfBody;
import org.objectweb.proactive.core.body.LocalBodyStore;
import org.objectweb.proactive.core.body.MetaObjectFactory;
import org.objectweb.proactive.core.body.ProActiveMetaObjectFactory;
import org.objectweb.proactive.core.body.UniversalBody;
import org.objectweb.proactive.core.body.exceptions.BodyTerminatedException;
import org.objectweb.proactive.core.body.ft.internalmsg.Heartbeat;
import org.objectweb.proactive.core.body.proxy.BodyProxy;
import org.objectweb.proactive.core.config.PAProperties;
import org.objectweb.proactive.core.config.ProActiveConfiguration;
import org.objectweb.proactive.core.mop.MOP;
import org.objectweb.proactive.core.mop.MOPException;
import org.objectweb.proactive.core.mop.Proxy;
import org.objectweb.proactive.core.mop.StubObject;
import org.objectweb.proactive.core.node.Node;
import org.objectweb.proactive.core.node.NodeException;
import org.objectweb.proactive.core.node.NodeFactory;
import org.objectweb.proactive.core.remoteobject.RemoteObject;
import org.objectweb.proactive.core.remoteobject.RemoteObjectHelper;
import org.objectweb.proactive.core.remoteobject.exception.UnknownProtocolException;
import org.objectweb.proactive.core.security.ProActiveSecurityManager;
import org.objectweb.proactive.core.security.SecurityConstants.EntityType;
import org.objectweb.proactive.core.util.NonFunctionalServices;
import org.objectweb.proactive.core.util.ProcessForAoCreation;
import org.objectweb.proactive.core.util.URIBuilder;
import org.objectweb.proactive.core.util.log.Loggers;
import org.objectweb.proactive.core.util.log.ProActiveLogger;
import org.objectweb.proactive.core.util.profiling.Profiling;


/**
 * This class provides the main operations on active objects. It allows to create and terminate an
 * active object, and to get a reference on it. It also provides methods to register and lookup an
 * active object through the network. Finally, it allows to control the synchronicity related
 * behaviour of an active object such as automatic continuation or immediate services.
 * 
 * @author The ProActive Team
 * @since ProActive 3.9 (December 2007)
 */
@PublicAPI
public class PAActiveObject {
    protected final static Logger logger = ProActiveLogger.getLogger(Loggers.CORE);
    private final static Heartbeat hb = new Heartbeat();

    static {
        ProActiveConfiguration.load();
        @SuppressWarnings("unused")
        // Execute RuntimeFactory's static blocks
        Class<?> c = org.objectweb.proactive.core.runtime.RuntimeFactory.class;
    }

    //
    // -- CONSTRUCTORS -----------------------------------------------
    //
    private PAActiveObject() {
    }

    /**
     * Creates a new ActiveObject based on classname attached to a default node in the local JVM.
     * 
     * @param classname
     *            the name of the class to instanciate as active
     * @param constructorParameters
     *            the parameters of the constructor.
     * @return a reference (possibly remote) on a Stub of the newly created active object
     * @exception ActiveObjectCreationException
     *                if a problem occur while creating the stub or the body
     * @exception NodeException
     *                if the DefaultNode cannot be created
     */
    public static Object newActive(String classname, Object[] constructorParameters)
            throws ActiveObjectCreationException, NodeException {
        return newActive(classname, null, constructorParameters, (Node) null, null, null);
    }

    /**
     * Creates a new ActiveObject based on classname attached to the node of the given URL.
     * 
     * @param classname
     *            the name of the class to instanciate as active
     * @param constructorParameters
     *            the parameters of the constructor.
     * @param nodeURL
     *            the URL of the node where to create the active object. If null, the active object
     *            is created localy on a default node
     * @return a reference (possibly remote) on a Stub of the newly created active object
     * @exception ActiveObjectCreationException
     *                if a problem occur while creating the stub or the body
     * @exception NodeException
     *                if the node URL cannot be resolved as an existing Node
     */
    public static Object newActive(String classname, Object[] constructorParameters, String nodeURL)
            throws ActiveObjectCreationException, NodeException {
        if (nodeURL == null) {
            return newActive(classname, null, constructorParameters, (Node) null, null, null);
        } else {
            return newActive(classname, null, constructorParameters, NodeFactory.getNode(nodeURL), null, null);<commit_msg>typo<commit_after>/*
 * ################################################################
 *
 * ProActive: The Java(TM) library for Parallel, Distributed,
 *            Concurrent computing with Security and Mobility
 *
 * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
 * Contact: <EMAIL>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 *  Initial developer(s):               The ProActive Team
 *                        http://proactive.inria.fr/team_members.htm
 *  Contributor(s):
 *
 * ################################################################
 */
package org.objectweb.proactive.api;

import java.io.IOException;
import java.lang.reflect.Array;
import java.net.URI;
import java.util.Vector;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import org.apache.log4j.Logger;
import org.objectweb.proactive.Active;
import org.objectweb.proactive.ActiveObjectCreationException;
import org.objectweb.proactive.Body;
import org.objectweb.proactive.annotation.PublicAPI;
import org.objectweb.proactive.benchmarks.timit.util.basic.TimItBasicManager;
import org.objectweb.proactive.core.ProActiveException;
import org.objectweb.proactive.core.ProActiveRuntimeException;
import org.objectweb.proactive.core.body.AbstractBody;
import org.objectweb.proactive.core.body.Context;
import org.objectweb.proactive.core.body.HalfBody;
import org.objectweb.proactive.core.body.LocalBodyStore;
import org.objectweb.proactive.core.body.MetaObjectFactory;
import org.objectweb.proactive.core.body.ProActiveMetaObjectFactory;
import org.objectweb.proactive.core.body.UniversalBody;
import org.objectweb.proactive.core.body.exceptions.BodyTerminatedException;
import org.objectweb.proactive.core.body.ft.internalmsg.Heartbeat;
import org.objectweb.proactive.core.body.proxy.BodyProxy;
import org.objectweb.proactive.core.config.PAProperties;
import org.objectweb.proactive.core.config.ProActiveConfiguration;
import org.objectweb.proactive.core.mop.MOP;
import org.objectweb.proactive.core.mop.MOPException;
import org.objectweb.proactive.core.mop.Proxy;
import org.objectweb.proactive.core.mop.StubObject;
import org.objectweb.proactive.core.node.Node;
import org.objectweb.proactive.core.node.NodeException;
import org.objectweb.proactive.core.node.NodeFactory;
import org.objectweb.proactive.core.remoteobject.RemoteObject;
import org.objectweb.proactive.core.remoteobject.RemoteObjectHelper;
import org.objectweb.proactive.core.remoteobject.exception.UnknownProtocolException;
import org.objectweb.proactive.core.security.ProActiveSecurityManager;
import org.objectweb.proactive.core.security.SecurityConstants.EntityType;
import org.objectweb.proactive.core.util.NonFunctionalServices;
import org.objectweb.proactive.core.util.ProcessForAoCreation;
import org.objectweb.proactive.core.util.URIBuilder;
import org.objectweb.proactive.core.util.log.Loggers;
import org.objectweb.proactive.core.util.log.ProActiveLogger;
import org.objectweb.proactive.core.util.profiling.Profiling;


/**
 * This class provides the main operations on active objects. It allows to create and terminate an
 * active object, and to get a reference on it. It also provides methods to register and lookup an
 * active object through the network. Finally, it allows to control the synchronicity related
 * behaviour of an active object such as automatic continuation or immediate services.
 * 
 * @author The ProActive Team
 * @since ProActive 3.9 (December 2007)
 */
@PublicAPI
public class PAActiveObject {
    protected final static Logger logger = ProActiveLogger.getLogger(Loggers.CORE);
    private final static Heartbeat hb = new Heartbeat();

    static {
        ProActiveConfiguration.load();
        @SuppressWarnings("unused")
        // Execute RuntimeFactory's static blocks
        Class<?> c = org.objectweb.proactive.core.runtime.RuntimeFactory.class;
    }

    //
    // -- CONSTRUCTORS -----------------------------------------------
    //
    private PAActiveObject() {
    }

    /**
     * Creates a new ActiveObject based on classname attached to a default node in the local JVM.
     * 
     * @param classname
     *            the name of the class to instanciate as active
     * @param constructorParameters
     *            the parameters of the constructor.
     * @return a reference (possibly remote) on a Stub of the newly created active object
     * @exception ActiveObjectCreationException
     *                if a problem occur while creating the stub or the body
     * @exception NodeException
     *                if the DefaultNode cannot be created
     */
    public static Object newActive(String classname, Object[] constructorParameters)
            throws ActiveObjectCreationException, NodeException {
        return newActive(classname, null, constructorParameters, (Node) null, null, null);
    }

    /**
     * Creates a new ActiveObject based on classname attached to the node of the given URL.
     * 
     * @param classname
     *            the name of the class to instantiate as active
     * @param constructorParameters
     *            the parameters of the constructor.
     * @param nodeURL
     *            the URL of the node where to create the active object. If null, the active object
     *            is created locally on a default node
     * @return a reference (possibly remote) on a Stub of the newly created active object
     * @exception ActiveObjectCreationException
     *                if a problem occur while creating the stub or the body
     * @exception NodeException
     *                if the node URL cannot be resolved as an existing Node
     */
    public static Object newActive(String classname, Object[] constructorParameters, String nodeURL)
            throws ActiveObjectCreationException, NodeException {
        if (nodeURL == null) {
            return newActive(classname, null, constructorParameters, (Node) null, null, null);
        } else {
            return newActive(classname, null, constructorParameters, NodeFactory.getNode(nodeURL), null, null);
{'fraction_non_alphanumeric': 0.10204682668237373, 'fraction_numerical': 0.004417611544691504, 'mean_word_length': 3.62793867120954, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7656835', 'n_tokens_mistral': 3611, 'n_tokens_neox': 3503, 'n_words': 1095}