Java 类javax.ejb.TimerConfig 实例源码

项目:oscm    文件:TimerServiceBean.java   
void createTimerWithPeriod(TimerService timerService, TimerType timerType,
        long timerOffset, Period period) {
    if (isTimerCreated(timerType, timerService)) {
        return;
    }
    TimerConfig config = new TimerConfig();
    config.setInfo(timerType);
    Date startDate = getDateForNextTimerExpiration(period, timerOffset);
    ScheduleExpression schedleExpression = getExpressionForPeriod(period,
            startDate);
    Timer timer = timerService.createCalendarTimer(schedleExpression,
            config);
    Date nextStart = timer.getNextTimeout();
    SimpleDateFormat sdf = new SimpleDateFormat();
    logger.logInfo(Log4jLogger.SYSTEM_LOG,
            LogMessageIdentifier.INFO_TIMER_CREATED,
            String.valueOf(timerType), sdf.format(nextStart));
}
项目:Mastering-Java-EE-Development-with-WildFly    文件:TimerBean.java   
public void programmaticTimeout() {
    logger.info("TimerEJB: programmatic timeout occurred");
    timeoutDone = false;
    long duration = 60;
    Timer timer = timerService.createSingleActionTimer(duration, new TimerConfig());
    timer.getInfo();
    try {
        timer.getSchedule();
    } catch (IllegalStateException e) {
        logger.log(SEVERE, "it is not a scheduler", e);
    }
    TimerHandle timerHandle = timer.getHandle();
    timerHandle.getTimer();
    timer.isCalendarTimer();
    timer.isPersistent();
    timer.getTimeRemaining();
}
项目:oscm    文件:TimerServiceBean2Test.java   
@Test
public void initTimers_interval() throws Exception {
    // given
    TimerServiceStub timeServiceStub = mock(TimerServiceStub.class);
    when(ctx.getTimerService()).thenReturn(timeServiceStub);
    TimerConfig timerConfig = new TimerConfig();
    timerConfig.setInfo(TimerType.BILLING_INVOCATION);
    doReturn(new TimerStub(null, timerConfig)).when(timeServiceStub)
            .createCalendarTimer(any(ScheduleExpression.class),
                    any(TimerConfig.class));

    // when
    tm.initTimers();

    // then
    verify(timeServiceStub, times(4)).createTimer(any(Date.class),
            eq(10000L), any(TimerType.class));
}
项目:iws    文件:MailSynchronizer.java   
/**
 * <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);
}
项目:bookery    文件:BatchJobService.java   
public BatchJobConfiguration fireUpTimer(BatchJobConfiguration jobConfig) {
    if (jobConfig.isActive()) {
        logger.debug("Configured batch job " + jobConfig.getType().getDisplayName());
        TimerConfig timerConf = new TimerConfig(jobConfig, false);
        String[] splittedCronJob = jobConfig.getCronJobExpression().split(" ");
        ScheduleExpression schedExp = new ScheduleExpression();
        schedExp.second(splittedCronJob[0]);
        schedExp.minute(splittedCronJob[1]);
        schedExp.hour(splittedCronJob[2]);
        schedExp.dayOfMonth(splittedCronJob[3]);
        schedExp.month(splittedCronJob[4]);
        schedExp.year(splittedCronJob[5]);
        schedExp.dayOfWeek(splittedCronJob[6]);
        Timer timer = timerService.createCalendarTimer(schedExp, timerConf);
        jobConfig.setNextTimeout(timer.getNextTimeout());
        jobConfig = batchJobConfigurationDAO.update(jobConfig);
    }
    return jobConfig;
}
项目:development    文件:TimerServiceBean.java   
void createTimerWithPeriod(TimerService timerService, TimerType timerType,
        long timerOffset, Period period) {
    if (isTimerCreated(timerType, timerService)) {
        return;
    }
    TimerConfig config = new TimerConfig();
    config.setInfo(timerType);
    Date startDate = getDateForNextTimerExpiration(period, timerOffset);
    ScheduleExpression schedleExpression = getExpressionForPeriod(period,
            startDate);
    Timer timer = timerService.createCalendarTimer(schedleExpression,
            config);
    Date nextStart = timer.getNextTimeout();
    SimpleDateFormat sdf = new SimpleDateFormat();
    logger.logInfo(Log4jLogger.SYSTEM_LOG,
            LogMessageIdentifier.INFO_TIMER_CREATED,
            String.valueOf(timerType), sdf.format(nextStart));
}
项目:development    文件:TimerServiceBean2Test.java   
@Test
public void initTimers_interval() throws Exception {
    // given
    TimerServiceStub timeServiceStub = mock(TimerServiceStub.class);
    when(ctx.getTimerService()).thenReturn(timeServiceStub);
    TimerConfig timerConfig = new TimerConfig();
    timerConfig.setInfo(TimerType.BILLING_INVOCATION);
    doReturn(new TimerStub(null, timerConfig)).when(timeServiceStub)
            .createCalendarTimer(any(ScheduleExpression.class),
                    any(TimerConfig.class));

    // when
    tm.initTimers();

    // then
    verify(timeServiceStub, times(4)).createTimer(any(Date.class),
            eq(10000L), any(TimerType.class));
}
项目:sinkit-core    文件:IoCWithCustomProtostreamGenerator.java   
@PostConstruct
private void initialize() {
    log.info("IoCWithCustomProtostreamGenerator initialize...");

    new File(GENERATED_PROTOFILES_DIRECTORY).mkdirs();

    if (SINKIT_ALL_IOC_PROTOSTREAM_GENERATOR_D_H_M_S != null) {
        timerService.createCalendarTimer(new ScheduleExpression()
                        .dayOfWeek(SINKIT_ALL_IOC_PROTOSTREAM_GENERATOR_D_H_M_S[0])
                        .hour(SINKIT_ALL_IOC_PROTOSTREAM_GENERATOR_D_H_M_S[1])
                        .minute(SINKIT_ALL_IOC_PROTOSTREAM_GENERATOR_D_H_M_S[2])
                        .second(SINKIT_ALL_IOC_PROTOSTREAM_GENERATOR_D_H_M_S[3])
                , new TimerConfig(ALL_IOC_TAG, false));
        log.info("IoCWithCustomProtostreamGenerator: All IoC Protostream Generator");
    }
    if (SINKIT_ALL_CUSTOM_PROTOSTREAM_GENERATOR_D_H_M_S != null) {
        timerService.createCalendarTimer(new ScheduleExpression()
                        .dayOfWeek(SINKIT_ALL_CUSTOM_PROTOSTREAM_GENERATOR_D_H_M_S[0])
                        .hour(SINKIT_ALL_CUSTOM_PROTOSTREAM_GENERATOR_D_H_M_S[1])
                        .minute(SINKIT_ALL_CUSTOM_PROTOSTREAM_GENERATOR_D_H_M_S[2])
                        .second(SINKIT_ALL_CUSTOM_PROTOSTREAM_GENERATOR_D_H_M_S[3])
                , new TimerConfig(ALL_CUSTOM_TAG, false));
        log.info("IoCWithCustomProtostreamGenerator: All Custom Protostream Generator");
    }
}
项目:sinkit-core    文件:CustomlistProtostreamGenerator.java   
@PostConstruct
private void initialize() {

    new File(GENERATED_PROTOFILES_DIRECTORY).mkdirs();

    if (SINKIT_CUSTOMLIST_PROTOSTREAM_GENERATOR_D_H_M_S != null) {
        timerService.createCalendarTimer(new ScheduleExpression()
                        .dayOfWeek(SINKIT_CUSTOMLIST_PROTOSTREAM_GENERATOR_D_H_M_S[0])
                        .hour(SINKIT_CUSTOMLIST_PROTOSTREAM_GENERATOR_D_H_M_S[1])
                        .minute(SINKIT_CUSTOMLIST_PROTOSTREAM_GENERATOR_D_H_M_S[2])
                        .second(SINKIT_CUSTOMLIST_PROTOSTREAM_GENERATOR_D_H_M_S[3])
                , new TimerConfig("CustomlistProtostreamGenerator", false));
    } else {
        log.info("CustomlistProtostreamGenerator timer not activated.");
    }
}
项目:tomee    文件:EjbTimerServiceImpl.java   
@Override
public Timer createTimer(final Object primaryKey,
                         final Method timeoutMethod,
                         final long duration,
                         final TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException {
    if (duration < 0) {
        throw new IllegalArgumentException("duration is negative: " + duration);
    }
    checkState();

    final Date expiration = new Date(System.currentTimeMillis() + duration);
    try {
        final TimerData timerData = timerStore.createSingleActionTimer(this, (String) deployment.getDeploymentID(), primaryKey, timeoutMethod, expiration, timerConfig);
        initializeNewTimer(timerData);
        return timerData.getTimer();
    } catch (final TimerStoreException e) {
        throw new EJBException(e);
    }
}
项目:tomee    文件:EjbTimerServiceImpl.java   
@Override
public Timer createTimer(final Object primaryKey,
                         final Method timeoutMethod,
                         final Date expiration,
                         final TimerConfig timerConfig) throws IllegalArgumentException, IllegalStateException, EJBException {
    if (expiration == null) {
        throw new IllegalArgumentException("expiration is null");
    }
    if (expiration.getTime() < 0) {
        throw new IllegalArgumentException("expiration is negative: " + expiration.getTime());
    }
    checkState();

    try {
        final TimerData timerData = timerStore.createSingleActionTimer(this, (String) deployment.getDeploymentID(), primaryKey, timeoutMethod, expiration, timerConfig);
        initializeNewTimer(timerData);
        return timerData.getTimer();
    } catch (final TimerStoreException e) {
        throw new EJBException(e);
    }
}
项目:tomee    文件:EjbTimerServiceImpl.java   
@Override
public Timer createTimer(final Object primaryKey, final Method timeoutMethod, final ScheduleExpression scheduleExpression, final TimerConfig timerConfig) {
    if (scheduleExpression == null) {
        throw new IllegalArgumentException("scheduleExpression is null");
    }
    //TODO add more schedule expression validation logic ?
    checkState();
    try {
        final TimerData timerData = timerStore.createCalendarTimer(this,
            (String) deployment.getDeploymentID(),
            primaryKey,
            timeoutMethod,
            scheduleExpression,
            timerConfig,
            false);
        initializeNewTimer(timerData);
        return timerData.getTimer();
    } catch (final TimerStoreException e) {
        throw new EJBException(e);
    }
}
项目:oscm    文件:TimerServiceStub.java   
@Override
public Timer createCalendarTimer(ScheduleExpression arg0, TimerConfig arg1)
        throws IllegalArgumentException, IllegalStateException,
        EJBException {
    TimerStub timer = new TimerStub(arg0, arg1);
    timers.add(timer);
    return timer;
}
项目:oscm    文件:TimerServiceStub.java   
@Override
public Timer createIntervalTimer(long arg0, long arg1, TimerConfig arg2)
        throws IllegalArgumentException, IllegalStateException,
        EJBException {

    return null;
}
项目:oscm    文件:TimerServiceStub.java   
@Override
public Timer createIntervalTimer(Date arg0, long arg1, TimerConfig arg2)
        throws IllegalArgumentException, IllegalStateException,
        EJBException {

    return null;
}
项目:oscm    文件:TimerServiceStub.java   
@Override
public Timer createSingleActionTimer(long arg0, TimerConfig arg1)
        throws IllegalArgumentException, IllegalStateException,
        EJBException {

    return null;
}
项目:oscm    文件:TimerServiceStub.java   
@Override
public Timer createSingleActionTimer(Date arg0, TimerConfig arg1)
        throws IllegalArgumentException, IllegalStateException,
        EJBException {

    return null;
}
项目:oscm    文件:TimerStub.java   
public TimerStub(ScheduleExpression scheduleExpression, TimerConfig config) {
    this.scheduleExpression = scheduleExpression;
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DAY_OF_YEAR, 1);
    this.execDate = cal.getTime();
    this.info = config.getInfo();
}
项目:redis-websocket-javaee    文件:PingForLeaders.java   
@PostConstruct
public void init() {
    /**
     * fires 5 secs after creation interval = 5 secs non-persistent
     * no-additional (custom) info
     */
    timer = ts.createIntervalTimer(5000, 5000, new TimerConfig(null, false)); //trigger every 5 seconds
    Logger.getLogger(PingForLeaders.class.getName()).log(Level.INFO, "Timer initiated");
    jedis = new Jedis("192.168.99.100", 6379, 10000);

}
项目:hiots    文件:DataChangeListenerLocalImpl.java   
private void createTimer(long interval) {
    if (tm == null)
        tm = context.getTimerService().createIntervalTimer(0, interval, new TimerConfig());
    else {
        tm.cancel();
        tm = context.getTimerService().createIntervalTimer(0, interval, new TimerConfig());
    }
    logger.debug("Timer started, remaining time: {}", tm.getTimeRemaining());
}
项目:hiots    文件:DummyDataGeneratorLocalImpl.java   
private void createTimer(long interval) {
    if (tm == null)
        tm = context.getTimerService().createIntervalTimer(0, interval, new TimerConfig());
    else {
        tm.cancel();
        tm = context.getTimerService().createIntervalTimer(0, interval, new TimerConfig());
    }
    logger.debug("Timer started, remaining time: {}", tm.getTimeRemaining());
}
项目:iws    文件:StateBean.java   
/**
 * 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.");
}
项目:ee-scheduler    文件:ProgrammaticPersistentScheduler.java   
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;
}
项目:cws    文件:StartupBean.java   
@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);
    }
}
项目:development    文件:TimerServiceStub.java   
@Override
public Timer createCalendarTimer(ScheduleExpression arg0, TimerConfig arg1)
        throws IllegalArgumentException, IllegalStateException,
        EJBException {
    TimerStub timer = new TimerStub(arg0, arg1);
    timers.add(timer);
    return timer;
}
项目:development    文件:TimerServiceStub.java   
@Override
public Timer createIntervalTimer(long arg0, long arg1, TimerConfig arg2)
        throws IllegalArgumentException, IllegalStateException,
        EJBException {

    return null;
}
项目:development    文件:TimerServiceStub.java   
@Override
public Timer createIntervalTimer(Date arg0, long arg1, TimerConfig arg2)
        throws IllegalArgumentException, IllegalStateException,
        EJBException {

    return null;
}
项目:development    文件:TimerServiceStub.java   
@Override
public Timer createSingleActionTimer(long arg0, TimerConfig arg1)
        throws IllegalArgumentException, IllegalStateException,
        EJBException {

    return null;
}
项目:development    文件:TimerServiceStub.java   
@Override
public Timer createSingleActionTimer(Date arg0, TimerConfig arg1)
        throws IllegalArgumentException, IllegalStateException,
        EJBException {

    return null;
}
项目:development    文件:TimerStub.java   
public TimerStub(ScheduleExpression scheduleExpression, TimerConfig config) {
    this.scheduleExpression = scheduleExpression;
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DAY_OF_YEAR, 1);
    this.execDate = cal.getTime();
    this.info = config.getInfo();
}
项目:gangehi    文件:ReminderService.java   
@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);
}
项目:sinkit-core    文件:IocProtostreamGenerator.java   
@PostConstruct
private void initialize() {
    if (SINKIT_IOC_PROTOSTREAM_GENERATOR_D_H_M_S != null) {
        timerService.createCalendarTimer(new ScheduleExpression()
                        .dayOfWeek(SINKIT_IOC_PROTOSTREAM_GENERATOR_D_H_M_S[0])
                        .hour(SINKIT_IOC_PROTOSTREAM_GENERATOR_D_H_M_S[1])
                        .minute(SINKIT_IOC_PROTOSTREAM_GENERATOR_D_H_M_S[2])
                        .second(SINKIT_IOC_PROTOSTREAM_GENERATOR_D_H_M_S[3])
                , new TimerConfig("IOCListProtostreamGenerator", false));
    } else {
        log.info("IOCListProtostreamGenerator timer not activated.");
    }
}
项目:sinkit-core    文件:WhitelistProtostreamGenerator.java   
@PostConstruct
private void initialize() {
    if (SINKIT_WHITELIST_PROTOSTREAM_GENERATOR_D_H_M_S != null) {
        timerService.createCalendarTimer(new ScheduleExpression()
                        .dayOfWeek(SINKIT_WHITELIST_PROTOSTREAM_GENERATOR_D_H_M_S[0])
                        .hour(SINKIT_WHITELIST_PROTOSTREAM_GENERATOR_D_H_M_S[1])
                        .minute(SINKIT_WHITELIST_PROTOSTREAM_GENERATOR_D_H_M_S[2])
                        .second(SINKIT_WHITELIST_PROTOSTREAM_GENERATOR_D_H_M_S[3])
                , new TimerConfig("WhitelistProtostreamGenerator", false));
    } else {
        log.info("WhitelistProtostreamGenerator timer not activated.");
    }
}
项目:http-queue    文件:JobManager.java   
public Job createJob(Job job) throws JobAlreadyExistsException {
    if (job.getId() != null && em.find(Job.class, job.getId()) != null) {
        throw new JobAlreadyExistsException();
    }

    ScheduleExpression schedule = new ScheduleExpression();
    schedule.second(job.getSecond());
    schedule.minute(job.getMinute());
    schedule.hour(job.getHour());
    schedule.dayOfMonth(job.getDayOfMonth());
    schedule.dayOfWeek(job.getDayOfWeek());
    schedule.month(job.getMonth());
    schedule.year(job.getYear());

    TimerConfig timerConfig = new TimerConfig(job.getId(), true);
    Timer timer = timerService.createCalendarTimer(schedule, timerConfig);
    TimerHandle timerHandle = timer.getHandle();
    job.serialize(timerHandle);

    logger.info("Timer {} created with cron expression {}. The next timeout is {}.", job.getId(),
            job.getCronExpression(), timer.getNextTimeout());

    if (job.getId() != null) {
        em.merge(job);
    } else {
        em.persist(job);
    }

    return job;
}
项目:tomcat_to_tomee    文件:EjbSingleton.java   
private void createTimer() {
    try {
        timer = this.timerService.createSingleActionTimer(15000, new TimerConfig("EjbSingleton.Timer", false));
    } catch (final Throwable e) {
        e.printStackTrace();
    }
}
项目:clap    文件:CleanUpService.java   
@PostConstruct
public void createTimer() {
    LOGGER.debug("Creating CleanUpService timer");
    timerService.createIntervalTimer(configBean.getMessagesCleanupInterval(),
            configBean.getMessagesCleanupInterval(),
            new TimerConfig(null, false));
}
项目:oracle-samples    文件:PriceVolumeBean.java   
@PostConstruct
public void init() {
    /* Intialize the EJB and create a timer */
    logger.log(Level.INFO, "Initializing EJB.");
    random = new Random();
    tservice.createIntervalTimer(1000, 1000, new TimerConfig());
}
项目:oracle-samples    文件:PriceVolumeBean.java   
@PostConstruct
public void init() {
    /* Intialize the EJB and create a timer */
    logger.log(Level.INFO, "Initializing EJB.");
    random = new Random();
    servlet = null;
    tservice.createIntervalTimer(1000, 1000, new TimerConfig());
}
项目:tomee    文件:FarmerBrown.java   
@PostConstruct
private void construct() {
    final TimerConfig plantTheCorn = new TimerConfig("plantTheCorn", false);
    timerService.createCalendarTimer(new ScheduleExpression().month(5).dayOfMonth("20-Last").minute(0).hour(8), plantTheCorn);
    timerService.createCalendarTimer(new ScheduleExpression().month(6).dayOfMonth("1-10").minute(0).hour(8), plantTheCorn);

    final TimerConfig harvestTheCorn = new TimerConfig("harvestTheCorn", false);
    timerService.createCalendarTimer(new ScheduleExpression().month(9).dayOfMonth("20-Last").minute(0).hour(8), harvestTheCorn);
    timerService.createCalendarTimer(new ScheduleExpression().month(10).dayOfMonth("1-10").minute(0).hour(8), harvestTheCorn);

    final TimerConfig checkOnTheDaughters = new TimerConfig("checkOnTheDaughters", false);
    timerService.createCalendarTimer(new ScheduleExpression().second("*").minute("*").hour("*"), checkOnTheDaughters);
}
项目:tomee    文件:MethodScheduleBuilder.java   
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));
        }

    }