当前位置: 首页>>代码示例>>Java>>正文


Java TimerConfig.setPersistent方法代码示例

本文整理汇总了Java中javax.ejb.TimerConfig.setPersistent方法的典型用法代码示例。如果您正苦于以下问题:Java TimerConfig.setPersistent方法的具体用法?Java TimerConfig.setPersistent怎么用?Java TimerConfig.setPersistent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.ejb.TimerConfig的用法示例。


在下文中一共展示了TimerConfig.setPersistent方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startup

import javax.ejb.TimerConfig; //导入方法依赖的package包/类
/**
 * <p>Starts the The Timer Scheduler to handle Mail Synchronization.</p>
 */
@PostConstruct
public void startup() {
    LOG.info("Starting IWS Mail Synchronize Bean.");

    // Registering the Timer Service. This will ensure that the Scheduler
    // is invoked at frequent intervals.
    final TimerConfig timerConfig = new TimerConfig();
    timerConfig.setInfo("IWS Mail Synchronize");
    timerConfig.setPersistent(false);
    final ScheduleExpression expression = new ScheduleExpression();
    final String[] time = settings.getMailSynchronizeTime().split(":", 2);
    expression.hour(time[0]).minute(time[1]);
    timerService.createCalendarTimer(expression, timerConfig);
    LOG.info("First synchronize run scheduled to begin at {}", expression);
}
 
开发者ID:IWSDevelopers,项目名称:iws,代码行数:19,代码来源:MailSynchronizer.java

示例2: startup

import javax.ejb.TimerConfig; //导入方法依赖的package包/类
/**
 * To ensure that the system State is always consistent, we have two things
 * that must be accomplished. First thing is to load the former state and
 * ensure that the system is working using this as base.<br />
 *   Second part is to have a timer service (cron job), which will once per
 * day run and perform certain cleanup actions.<br />
 *   This method is run once the Bean is initialized and will perform two
 * things, first it will initialize the Timer Service, so it can run at
 * frequent Intervals, secondly, it will initialize the Sessions.<br />
 *   Heavier maintenance operations like cleaning up accounts is left for
 * the Timed Service to handle, since it may otherwise put the server under
 * unnecessary pressure during the initial Startup Phase.
 */
@PostConstruct
public void startup() {
    LOG.info("Starting IWS Initialization.");

    // First, we need to initialize our dependencies
    activeSessions = ActiveSessions.getInstance(settings);
    accessDao = new AccessJpaDao(entityManager, settings);
    exchangeDao = new ExchangeJpaDao(entityManager, settings);
    service = new AccountService(settings, accessDao, notifications);

    // Second, we're registering the Timer Service. This will ensure that the
    // Bean is invoked daily at 2 in the morning.
    final TimerConfig timerConfig = new TimerConfig();
    timerConfig.setInfo("IWS State Cleaner");
    timerConfig.setPersistent(false);
    final ScheduleExpression expression = new ScheduleExpression();
    final String[] time = settings.getRunCleanTime().split(":", 2);
    expression.hour(time[0]).minute(time[1]);
    timerService.createCalendarTimer(expression, timerConfig);
    LOG.info("First cleanup run scheduled to begin at {}", expression);

    if (settings.resetSessionsAtStartup()) {
        // Now, remove all deprecated Sessions from the Server. These Sessions
        // may or may not work correctly, since IW4 with JSF is combining the
        // Sessions with a Windows Id, and upon restart - the Windows Id is
        // renewed. Even if it isn't renewed, JSF will not recognize it
        final int deprecated = accessDao.deprecateAllActiveSessions();
        LOG.info("Deprecated {} Stale Sessions.", deprecated);
    } else {
        loadActiveTokens();
    }

    // That's it - we're done :-)
    LOG.info("IWS Initialization Completed.");
}
 
开发者ID:IWSDevelopers,项目名称:iws,代码行数:49,代码来源:StateBean.java

示例3: createTimerConfig

import javax.ejb.TimerConfig; //导入方法依赖的package包/类
private TimerConfig createTimerConfig() {
    TimerConfig timerConfig = new TimerConfig();

    // The name of the scheduler
    timerConfig.setInfo("ProgrammaticPersistentScheduler");

    // The scheduler is persistent.
    // Set to false if we do want a non persistent scheduler
    timerConfig.setPersistent(true);

    return timerConfig;
}
 
开发者ID:gualtierotesta,项目名称:ee-scheduler,代码行数:13,代码来源:ProgrammaticPersistentScheduler.java

示例4: startup

import javax.ejb.TimerConfig; //导入方法依赖的package包/类
@PostConstruct
public void startup() {
    log.info("Check if Database is up-to-date.");
    if (checkDatabase()) {

        log.info("Initialize the Settings.");
        initializeSettings();

        log.info("Initializing the CWS Sanitizer Service.");

        // If requested, then simply start the sanitize as a background job
        // now. The job will process small blocks of code and save these.
        if (settings.getSanityStartup()) {
            runSanitizing();
        }

        // Registering the Timer Service. This will ensure that the Scheduler
        // is invoked at frequent intervals.
        final TimerConfig timerConfig = new TimerConfig();
        timerConfig.setInfo("CWS Sanitizer");

        // Once started, the next run should always occur as planned, regardless
        // of restarts, as it is not guaranteed that the sanitizing is performed
        // at startup.
        timerConfig.setPersistent(true);

        // Starting the Timer Service every hour.
        final ScheduleExpression expression = new ScheduleExpression();
        expression.hour("*");
        timerService.createCalendarTimer(expression, timerConfig);
    }
}
 
开发者ID:JavaDogs,项目名称:cws,代码行数:33,代码来源:StartupBean.java

示例5: setTimer

import javax.ejb.TimerConfig; //导入方法依赖的package包/类
@PostConstruct
public void setTimer() {

	// TODO: move the configuration to the properties table
	ScheduleExpression schedule = new ScheduleExpression();
	schedule.second("4");
	schedule.minute("*");
	schedule.hour("*");
	// schedule.hour("8, 13, 16");
	schedule.dayOfWeek("Mon-Fri");
	TimerConfig timerConfig = new TimerConfig();
	timerConfig.setPersistent(false);
	timerService.createCalendarTimer(schedule, timerConfig);
}
 
开发者ID:awizen,项目名称:gangehi,代码行数:15,代码来源:ReminderService.java

示例6: addSchedulesToMethod

import javax.ejb.TimerConfig; //导入方法依赖的package包/类
private void addSchedulesToMethod(final MethodContext methodContext, final MethodScheduleInfo info) {

        if (methodContext == null) {
            return;
        }

        for (final ScheduleInfo scheduleInfo : info.schedules) {

            final ScheduleExpression expr = new ScheduleExpression();
            expr.second(scheduleInfo.second == null ? "0" : scheduleInfo.second);
            expr.minute(scheduleInfo.minute == null ? "0" : scheduleInfo.minute);
            expr.hour(scheduleInfo.hour == null ? "0" : scheduleInfo.hour);
            expr.dayOfWeek(scheduleInfo.dayOfWeek == null ? "*" : scheduleInfo.dayOfWeek);
            expr.dayOfMonth(scheduleInfo.dayOfMonth == null ? "*" : scheduleInfo.dayOfMonth);
            expr.month(scheduleInfo.month == null ? "*" : scheduleInfo.month);
            expr.year(scheduleInfo.year == null ? "*" : scheduleInfo.year);
            expr.timezone(scheduleInfo.timezone);
            expr.start(scheduleInfo.start);
            expr.end(scheduleInfo.end);

            final TimerConfig config = new TimerConfig();
            config.setInfo(scheduleInfo.info);
            config.setPersistent(scheduleInfo.persistent);

            methodContext.getSchedules().add(new ScheduleData(config, expr));
        }

    }
 
开发者ID:apache,项目名称:tomee,代码行数:29,代码来源:MethodScheduleBuilder.java

示例7: setTimerNow

import javax.ejb.TimerConfig; //导入方法依赖的package包/类
public Timer setTimerNow() {
    final ScheduleExpression schedule = new ScheduleExpression().second("*/3").minute("*").hour("*");

    final TimerConfig timerConfig = new TimerConfig();
    timerConfig.setPersistent(false);

    return timerService.createCalendarTimer(schedule, timerConfig);
}
 
开发者ID:apache,项目名称:tomee,代码行数:9,代码来源:TransactionRegistryInTimeoutTest.java

示例8: scheduleDelivery

import javax.ejb.TimerConfig; //导入方法依赖的package包/类
/**
    * Schedules an asynchronous delivery of messages in the given topic.
    * 
    * @param timeout  timeout after which the delivery is started
    * @param topic    the topic for which delivery is scheduled
    */
   private void scheduleDelivery(long timeout, String topic) {
this.timerByTopicLock.lock();
try {
    if (this.timerByTopic.get(topic) != null) return;
    TimerConfig config = new TimerConfig();
    config.setPersistent(false);
    config.setInfo(topic);
    Timer timer = timerService.createSingleActionTimer(timeout, config);
    this.timerByTopic.put(topic, timer);
} finally {
    timerByTopicLock.unlock();
}
   }
 
开发者ID:JEEventStore,项目名称:JEECQRS,代码行数:20,代码来源:LocalMultiTopicPublisher.java

示例9: initialize

import javax.ejb.TimerConfig; //导入方法依赖的package包/类
@PostConstruct
public void initialize() {
    TimerConfig timerConfig = new TimerConfig();
    timerConfig.setPersistent(false);
    timerService.createIntervalTimer(0, getIntervalDuration(), timerConfig);
}
 
开发者ID:evgeniy-khist,项目名称:disqus-synchronization,代码行数:7,代码来源:DisqusSynchronizationTimerService.java

示例10: scheduleStartup

import javax.ejb.TimerConfig; //导入方法依赖的package包/类
private void scheduleStartup() {
    TimerConfig config = new TimerConfig();
    config.setPersistent(false);
    timerService.createSingleActionTimer(startupDelay, config);
}
 
开发者ID:JEEventStore,项目名称:JEECQRS,代码行数:6,代码来源:AbstractApplicationStartup.java

示例11: scheduleEarlyCron

import javax.ejb.TimerConfig; //导入方法依赖的package包/类
private void scheduleEarlyCron(long timeout) {
    timeout = Math.min(timeout, 1); // sanity check
    TimerConfig config = new TimerConfig();
    config.setPersistent(false);
    timerService.createSingleActionTimer(timeout, config);
}
 
开发者ID:JEEventStore,项目名称:JEECQRS,代码行数:7,代码来源:AbstractPollingSagaTracker.java

示例12: register

import javax.ejb.TimerConfig; //导入方法依赖的package包/类
public void register(final String clientId) {

        sendMessage(REGISTER_ENDPOINT, applicationConfig.toJSON());

        ScheduleExpression schedule = new ScheduleExpression();
        schedule.second("*/10").minute("*").hour("*").start(Calendar.getInstance().getTime());

        TimerConfig config = new TimerConfig();
        config.setPersistent(false);

        Timer timer = timerService.createCalendarTimer(schedule, config);

        LOGGER.config(() -> timer.getSchedule().toString());
    }
 
开发者ID:ivargrimstad,项目名称:snoopee,代码行数:15,代码来源:SnoopEERegistrationClient.java


注:本文中的javax.ejb.TimerConfig.setPersistent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。