<commit_before>package org.motechproject.nms.kilkari.handler;

import org.apache.commons.lang.StringUtils;
import org.joda.time.DateTime;
import org.motechproject.event.MotechEvent;
import org.motechproject.event.listener.annotations.MotechListener;
import org.motechproject.metrics.service.Timer;
import org.motechproject.nms.kilkari.service.SubscriptionService;
import org.motechproject.nms.kilkari.utils.KilkariConstants;
import org.motechproject.scheduler.contract.CronSchedulableJob;
import org.motechproject.scheduler.service.MotechSchedulerService;
import org.motechproject.server.config.SettingsFacade;
import org.quartz.CronExpression;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.PostConstruct;

/**
 * Kikari subscription manager that takes care of purging subscriptions and maintaining current cap
 */
@Component
public class SubscriptionManagerHandler {

    private static final Logger LOGGER = LoggerFactory.getLogger(SubscriptionManagerHandler.class);

    @Autowired
    @Qualifier("kilkariSettings")
    private SettingsFacade settingsFacade;

    @Autowired
    private MotechSchedulerService schedulerService;

    @Autowired
    private SubscriptionService subscriptionService;

    /**
     * Use the MOTECH scheduler to setup a repeating job
     * The job will start today at the time stored in flw.purge_invalid_flw_start_time in flw.properties
     * It will repeat based on cron (default value is a day @ 4:02am)
     */
    @PostConstruct
    public void initSubscriptionManager() {
        String cronExpression = settingsFacade.getProperty(KilkariConstants.SUBSCRIPTION_MANAGER_CRON);
        if (StringUtils.isBlank(cronExpression)) {
            LOGGER.error("No cron expression found for purging subscriptions");<commit_msg>Removing transactional from listener<commit_after>package org.motechproject.nms.kilkari.handler;

import org.apache.commons.lang.StringUtils;
import org.joda.time.DateTime;
import org.motechproject.event.MotechEvent;
import org.motechproject.event.listener.annotations.MotechListener;
import org.motechproject.metrics.service.Timer;
import org.motechproject.nms.kilkari.service.SubscriptionService;
import org.motechproject.nms.kilkari.utils.KilkariConstants;
import org.motechproject.scheduler.contract.CronSchedulableJob;
import org.motechproject.scheduler.service.MotechSchedulerService;
import org.motechproject.server.config.SettingsFacade;
import org.quartz.CronExpression;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * Kikari subscription manager that takes care of purging subscriptions and maintaining current cap
 */
@Component
public class SubscriptionManagerHandler {

    private static final Logger LOGGER = LoggerFactory.getLogger(SubscriptionManagerHandler.class);

    @Autowired
    @Qualifier("kilkariSettings")
    private SettingsFacade settingsFacade;

    @Autowired
    private MotechSchedulerService schedulerService;

    @Autowired
    private SubscriptionService subscriptionService;

    /**
     * Use the MOTECH scheduler to setup a repeating job
     * The job will start today at the time stored in flw.purge_invalid_flw_start_time in flw.properties
     * It will repeat based on cron (default value is a day @ 4:02am)
     */
    @PostConstruct
    public void initSubscriptionManager() {
        String cronExpression = settingsFacade.getProperty(KilkariConstants.SUBSCRIPTION_MANAGER_CRON);
        if (StringUtils.isBlank(cronExpression)) {
            LOGGER.error("No cron expression found for purging subscriptions");
{'fraction_non_alphanumeric': 0.07476403378042722, 'fraction_numerical': 0.0024838549428713363, 'mean_word_length': 5.2921875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1224420', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1122, 'n_words': 248}