Package org.jboss.as.ejb3.timerservice

Examples of org.jboss.as.ejb3.timerservice.AutoTimer


    private void parseScheduleMethods(final EnterpriseBeanMetaData beanMetaData, final EJBComponentDescription sessionBean, final Class<?> componentClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException {
        if (beanMetaData instanceof IScheduleTarget) {
            IScheduleTarget md = (IScheduleTarget) beanMetaData;
            if (md.getTimers() != null) {
                for (final TimerMetaData timer : md.getTimers()) {
                    AutoTimer autoTimer = new AutoTimer();

                    autoTimer.getTimerConfig().setInfo(timer.getInfo());
                    autoTimer.getTimerConfig().setPersistent(timer.isPersistent());

                    final ScheduleExpression scheduleExpression = autoTimer.getScheduleExpression();
                    final ScheduleMetaData schedule = timer.getSchedule();
                    if (schedule != null) {
                        scheduleExpression.dayOfMonth(schedule.getDayOfMonth());
                        scheduleExpression.dayOfWeek(schedule.getDayOfWeek());
                        scheduleExpression.hour(schedule.getHour());
View Full Code Here


        super(Schedule.class, Schedules.class);
    }

    @Override
    protected AutoTimer fromAnnotation(final AnnotationInstance annotationInstance) {
        final AutoTimer timer = new AutoTimer();
        for (ScheduleValues schedulePart : ScheduleValues.values()) {
            schedulePart.set(timer, annotationInstance);
        }
        return timer;
    }
View Full Code Here

    private void parseScheduleMethods(final EnterpriseBeanMetaData beanMetaData, final EJBComponentDescription sessionBean, final Class<?> componentClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException {
        if (beanMetaData instanceof IScheduleTarget) {
            IScheduleTarget md = (IScheduleTarget) beanMetaData;
            if (md.getTimers() != null) {
                for (final TimerMetaData timer : md.getTimers()) {
                    AutoTimer autoTimer = new AutoTimer();

                    autoTimer.getTimerConfig().setInfo(timer.getInfo());
                    autoTimer.getTimerConfig().setPersistent(timer.isPersistent());

                    final ScheduleExpression scheduleExpression = autoTimer.getScheduleExpression();
                    final ScheduleMetaData schedule = timer.getSchedule();
                    if (schedule != null) {
                        scheduleExpression.dayOfMonth(schedule.getDayOfMonth());
                        scheduleExpression.dayOfWeek(schedule.getDayOfWeek());
                        scheduleExpression.hour(schedule.getHour());
View Full Code Here

        super(Schedule.class, Schedules.class);
    }

    @Override
    protected AutoTimer fromAnnotation(final AnnotationInstance annotationInstance, final PropertyReplacer propertyReplacer) {
        final AutoTimer timer = new AutoTimer();
        for (ScheduleValues schedulePart : ScheduleValues.values()) {
            schedulePart.set(timer, annotationInstance, propertyReplacer);
        }
        return timer;
    }
View Full Code Here

    private void parseScheduleMethods(final EnterpriseBeanMetaData beanMetaData, final EJBComponentDescription sessionBean, final Class<?> componentClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException {
        if (beanMetaData instanceof IScheduleTarget) {
            IScheduleTarget md = (IScheduleTarget) beanMetaData;
            if (md.getTimers() != null) {
                for (final TimerMetaData timer : md.getTimers()) {
                    AutoTimer autoTimer = new AutoTimer();

                    autoTimer.getTimerConfig().setInfo(timer.getInfo());
                    autoTimer.getTimerConfig().setPersistent(timer.isPersistent());

                    final ScheduleExpression scheduleExpression = autoTimer.getScheduleExpression();
                    final ScheduleMetaData schedule = timer.getSchedule();
                    if (schedule != null) {
                        scheduleExpression.dayOfMonth(schedule.getDayOfMonth());
                        scheduleExpression.dayOfWeek(schedule.getDayOfWeek());
                        scheduleExpression.hour(schedule.getHour());
View Full Code Here

                for (AnnotationInstance annotationInstance : annotations) {
                    if (enabled) {
                        AnnotationTarget target = annotationInstance.target();
                        if (target instanceof MethodInfo) {
                            final MethodIdentifier identifier = getMethodIdentifier(target);
                            final AutoTimer timer = new AutoTimer();
                            for (ScheduleValues schedulePart : ScheduleValues.values()) {
                                schedulePart.set(timer, annotationInstance);
                            }
                            componentDescription.addScheduleMethodIdentifier(identifier, timer);
                        }
                    } else {
                        logger.warn("@Schedule annotation found on " + annotationInstance.target() + " but timer service is not enabled");
                    }
                }
            }
            List<AnnotationInstance> schedules = classAnnotations.get(SCHEDULES_ANNOTATION);
            if (schedules != null) {
                for (AnnotationInstance annotationInstance : schedules) {
                    AnnotationTarget target = annotationInstance.target();
                    if (enabled) {
                        if (target instanceof MethodInfo) {

                            final MethodIdentifier identifier = getMethodIdentifier(target);
                            final AnnotationInstance[] values = annotationInstance.value().asNestedArray();
                            for (AnnotationInstance schedule : values) {

                                final AutoTimer timer = new AutoTimer();
                                for (ScheduleValues schedulePart : ScheduleValues.values()) {
                                    schedulePart.set(timer, schedule);
                                }
                                componentDescription.addScheduleMethodIdentifier(identifier, timer);
                            }
View Full Code Here

    private void parseScheduleMethods(final SessionBeanMetaData beanMetaData, final SessionBeanComponentDescription sessionBean, final Class<?> componentClass, final DeploymentReflectionIndex deploymentReflectionIndex) throws DeploymentUnitProcessingException {
        if (beanMetaData instanceof SessionBean31MetaData) {
            SessionBean31MetaData md = (SessionBean31MetaData) beanMetaData;
            if (md.getTimers() != null) {
                for (final TimerMetaData timer : md.getTimers()) {
                    AutoTimer autoTimer = new AutoTimer();

                    autoTimer.getTimerConfig().setInfo(timer.getInfo());
                    autoTimer.getTimerConfig().setPersistent(timer.isPersistent());

                    final ScheduleExpression scheduleExpression = autoTimer.getScheduleExpression();
                    final ScheduleMetaData schedule = timer.getSchedule();
                    if (schedule != null) {
                        scheduleExpression.dayOfMonth(schedule.getDayOfMonth());
                        scheduleExpression.dayOfWeek(schedule.getDayOfWeek());
                        scheduleExpression.hour(schedule.getHour());
View Full Code Here

            }
        }, OperationContext.Stage.RUNTIME);

        newControllers.add(context.getServiceTarget().addService(TimerServiceDeploymentProcessor.TIMER_SERVICE_NAME, new TimerValueService())
                .install());
        final FileTimerPersistence fileTimerPersistence = new FileTimerPersistence(true, path, relativeTo);
        newControllers.add(context.getServiceTarget().addService(FileTimerPersistence.SERVICE_NAME, fileTimerPersistence)
                .addDependency(Services.JBOSS_SERVICE_MODULE_LOADER, ModuleLoader.class, fileTimerPersistence.getModuleLoader())
                .addDependency(PathManagerService.SERVICE_NAME, PathManager.class, fileTimerPersistence.getPathManager())
                .addDependency(TransactionManagerService.SERVICE_NAME, TransactionManager.class, fileTimerPersistence.getTransactionManager())
                .addDependency(TransactionSynchronizationRegistryService.SERVICE_NAME, TransactionSynchronizationRegistry.class, fileTimerPersistence.getTransactionSynchronizationRegistry())
                .install());

    }
View Full Code Here

        ScheduleExpression everySecondExpression = this.getTimezoneSpecificScheduleExpression();
        everySecondExpression.second("*");
        everySecondExpression.minute("*");
        everySecondExpression.hour("*");

        CalendarBasedTimeout calendarTimeout = new CalendarBasedTimeout(everySecondExpression);

        Calendar firstTimeout = calendarTimeout.getFirstTimeout();
        Calendar nextTimeout = calendarTimeout.getNextTimeout(firstTimeout);

        Assert.assertNotNull("Next timeout is null", nextTimeout);
        Assert.assertNotNull("Next timeout is *before* the current time", nextTimeout.after(firstTimeout));
        logger.debug("Previous timeout was: " + firstTimeout.getTime() + " Next timeout is " + nextTimeout.getTime());
        long diff = nextTimeout.getTimeInMillis() - firstTimeout.getTimeInMillis();
View Full Code Here

    public void testEveryMinuteEveryHourEveryDay() {
        ScheduleExpression everyMinEveryHourEveryDay = this.getTimezoneSpecificScheduleExpression();
        everyMinEveryHourEveryDay.minute("*");
        everyMinEveryHourEveryDay.hour("*");

        CalendarBasedTimeout calendarTimeout = new CalendarBasedTimeout(everyMinEveryHourEveryDay);

        Calendar firstTimeout = calendarTimeout.getFirstTimeout();
        Calendar previousTimeout = firstTimeout;
        for (int i = 1; i <= 65; i++) {
            Calendar nextTimeout = calendarTimeout.getNextTimeout(previousTimeout);

            Assert.assertNotNull("Next timeout is null", nextTimeout);
            Assert.assertNotNull("Next timeout is *before* the current time", nextTimeout.after(previousTimeout));
            logger.debug("First timeout was: " + firstTimeout.getTime() + " Previous timeout was: "
                    + previousTimeout.getTime() + " Next timeout is " + nextTimeout.getTime());
View Full Code Here

TOP

Related Classes of org.jboss.as.ejb3.timerservice.AutoTimer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.