<commit_before>/*
 * Copyright to the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.rioproject.cybernode;

import net.jini.config.ConfigurationException;
import org.rioproject.config.AggregateConfig;
import org.rioproject.config.GroovyConfig;
import org.rioproject.opstring.ServiceBeanConfig;
import org.rioproject.core.jsb.ServiceBeanContext;
import org.rioproject.jsb.JSBContext;
import org.rioproject.log.LoggerConfig;

import java.lang.reflect.Field;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;

/**
 * Service termination helper.
 */
public class ServiceTerminationHelper {

    /**
     * Cleanup resources that may cause memory leaks
     *
     * @param context The <code>ServiceBeanContext</code> to use
     */
    public static void cleanup(ServiceBeanContext context) {
        if (context != null) {
            /* Release any created Handlers */
            Map map = context.getServiceBeanConfig().getConfigurationParameters();
            LoggerConfig[] loggerConfigs = (LoggerConfig[]) map.get(ServiceBeanConfig.LOGGER);
            if (loggerConfigs != null) {
                for (LoggerConfig loggerConfig : loggerConfigs) {<commit_msg>Change to use loggerConfig property in ServiceBeanConfig<commit_after>/*
 * Copyright to the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.rioproject.cybernode;

import net.jini.config.ConfigurationException;
import org.rioproject.config.AggregateConfig;
import org.rioproject.config.GroovyConfig;
import org.rioproject.core.jsb.ServiceBeanContext;
import org.rioproject.jsb.JSBContext;
import org.rioproject.log.LoggerConfig;

import java.lang.reflect.Field;
import java.security.AccessController;
import java.security.PrivilegedAction;

/**
 * Service termination helper.
 */
public class ServiceTerminationHelper {

    /**
     * Cleanup resources that may cause memory leaks
     *
     * @param context The <code>ServiceBeanContext</code> to use
     */
    public static void cleanup(ServiceBeanContext context) {
        if (context != null) {
            /* Release any created Handlers */
            LoggerConfig[] loggerConfigs = context.getServiceBeanConfig().getLoggerConfigs();
            if (loggerConfigs != null) {
                for (LoggerConfig loggerConfig : loggerConfigs) {
{'fraction_non_alphanumeric': 0.08437956204379563, 'fraction_numerical': 0.0023357664233576644, 'mean_word_length': 3.7255172413793103, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5837491', 'n_tokens_mistral': 909, 'n_tokens_neox': 884, 'n_words': 308}