<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 functionalTests.component.immediateservice;

import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import org.objectweb.proactive.Body;
import org.objectweb.proactive.api.ProActiveObject;
import org.objectweb.proactive.core.component.body.ComponentInitActive;
import org.objectweb.proactive.core.util.wrapper.StringWrapper;


public class A implements Itf, ComponentInitActive {
    private boolean condition = true;

    /**
     * Initialize the immediate service method in the initComponentActivity
     */
    public void initComponentActivity(Body body) {
        ProActiveObject.setImmediateService("immediateMethod",
            new Class[] { String.class });
        //        ProActive.setImmediateService("startFc",
        //                new Class[] { });
        ProActiveObject.setImmediateService("immediateStopLoopMethod");
        //ProActive.setImmediateService("startFc");
    }

    public StringWrapper immediateMethod(String arg) {
        System.err.println("COMPONENT: immediateMethod: " + arg);
        StringWrapper res = new StringWrapper(arg + "success");
        condition = false;
        return res;
    }

    /**
     * This method never terminate, unless that the immediateStopLoopMethod (an immediate service) is called.
     */
    public void loopQueueMethod() {
        System.err.println("COMPONENT: loopQueueMethod: BEGINNING");
        while (condition)
            ;
        System.err.println("COMPONENT: loopQueueMethod: END");
    }

    public void immediateStopLoopMethod() {
        System.err.println("COMPONENT: immediateStopLoopMethod");
        condition = false;
    }

    public void startFc() throws IllegalLifeCycleException {
        System.err.println("MY_startFc");
    }
}
<commit_msg>fix a potential bug to due variable never updated on a local thread<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 functionalTests.component.immediateservice;

import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import org.objectweb.proactive.Body;
import org.objectweb.proactive.api.ProActiveObject;
import org.objectweb.proactive.core.component.body.ComponentInitActive;
import org.objectweb.proactive.core.util.wrapper.StringWrapper;


public class A implements Itf, ComponentInitActive {
    private volatile boolean condition = true;

    /**
     * Initialize the immediate service method in the initComponentActivity
     */
    public void initComponentActivity(Body body) {
        ProActiveObject.setImmediateService("immediateMethod",
            new Class[] { String.class });
        //        ProActive.setImmediateService("startFc",
        //                new Class[] { });
        ProActiveObject.setImmediateService("immediateStopLoopMethod");
        //ProActive.setImmediateService("startFc");
    }

    public StringWrapper immediateMethod(String arg) {
        System.err.println("COMPONENT: immediateMethod: " + arg);
        StringWrapper res = new StringWrapper(arg + "success");
        condition = false;
        return res;
    }

    /**
     * This method never terminate, unless that the immediateStopLoopMethod (an immediate service) is called.
     */
    public void loopQueueMethod() {
        System.err.println("COMPONENT: loopQueueMethod: BEGINNING");
        while (condition) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.err.println("COMPONENT: loopQueueMethod: END");
    }

    public void immediateStopLoopMethod() {
        System.err.println("COMPONENT: immediateStopLoopMethod");
        condition = false;
    }

    public void startFc() throws IllegalLifeCycleException {
        System.err.println("MY_startFc");
    }
}

{'fraction_non_alphanumeric': 0.12435649935649935, 'fraction_numerical': 0.007882882882882882, 'mean_word_length': 3.197839297771776, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '826075', 'n_tokens_mistral': 1627, 'n_tokens_neox': 1537, 'n_words': 491}