Package javax.ejb

Examples of javax.ejb.TimerConfig


            expr.year(scheduleInfo.year == null ? "*" : scheduleInfo.year);
            expr.timezone(scheduleInfo.timezone);
            expr.start(scheduleInfo.start);
            expr.end(scheduleInfo.end);

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

            methodContext.getSchedules().add(new ScheduleData(config, expr));
        }
       
    }
View Full Code Here


        bean.getTimerService().createTimer(TIMER_TIMEOUT_TIME_MS, INFO_MSG_FOR_CHECK);
        Assert.assertTrue(TimedObjectTimerServiceBean.awaitTimerCall());

        bean.resetTimerServiceCalled();
        long ts = (new Date()).getTime() + TIMER_INIT_TIME_MS;
        TimerConfig timerConfig = new TimerConfig();
        timerConfig.setInfo(INFO_MSG_FOR_CHECK);
        bean.getTimerService().createSingleActionTimer(new Date(ts), timerConfig);
        Assert.assertTrue(TimedObjectTimerServiceBean.awaitTimerCall());

        Assert.assertEquals(INFO_MSG_FOR_CHECK, bean.getTimerInfo());
        Assert.assertFalse(bean.isCalendar());
View Full Code Here

        bean.getTimerService().createTimer(TIMER_TIMEOUT_TIME_MS, INFO_MSG_FOR_CHECK);
        Assert.assertTrue(TimedObjectTimerServiceBean.awaitTimerCall());

        bean.resetTimerServiceCalled();
        long ts = (new Date()).getTime() + TIMER_INIT_TIME_MS;
        TimerConfig timerConfig = new TimerConfig();
        timerConfig.setInfo(INFO_MSG_FOR_CHECK);
        bean.getTimerService().createSingleActionTimer(new Date(ts), timerConfig);
        Assert.assertTrue(TimedObjectTimerServiceBean.awaitTimerCall());

        Assert.assertEquals(INFO_MSG_FOR_CHECK, bean.getTimerInfo());
        Assert.assertFalse(bean.isCalendar());
View Full Code Here

    @Test
    @InSequence(3)
    public void testIntervalTimer() throws NamingException {
        InitialContext ctx = new InitialContext();
        TimerConfig timerConfig = new TimerConfig();
        timerConfig.setInfo(INFO_MSG_FOR_CHECK);

        AnnotationTimerServiceBean bean1 = (AnnotationTimerServiceBean) ctx.lookup("java:module/" + AnnotationTimerServiceBean.class.getSimpleName());
        bean1.resetTimerServiceCalled();
        long ts = (new Date()).getTime() + TIMER_INIT_TIME_MS;
        Timer timer1 = bean1.getTimerService().createIntervalTimer(new Date(ts), TIMER_TIMEOUT_TIME_MS, timerConfig);
View Full Code Here

    @Resource
    private TimerService timerService;

    public void createTimer() {
        timerService.createCalendarTimer(new ScheduleExpression().second("*").minute("*").hour("*").dayOfMonth("*").year("*"), new TimerConfig(MESSAGE, true));
    }
View Full Code Here

        ModelNode op = new ModelNode();
        Timer timer = null;
        try {
            try {
                timer = bean.getTimerService().createIntervalTimer(100, 100, new TimerConfig("", false));
                Assert.assertTrue(SuspendTimerServiceBean.awaitTimerServiceCount() > 0);

                op.get(ModelDescriptionConstants.OP).set("suspend");
                managementClient.getControllerClient().execute(op);
View Full Code Here

                op.get(ModelDescriptionConstants.OP).set("suspend");
                managementClient.getControllerClient().execute(op);

                //create the timer while the container is suspended
                start = System.currentTimeMillis();
                timer = bean.getTimerService().createIntervalTimer(100, 100, new TimerConfig("", false));
                Thread.sleep(5000);

                Assert.assertEquals(0, SuspendTimerServiceBean.getTimerServiceCount());

            } finally {
View Full Code Here

                op.get(ModelDescriptionConstants.OP).set("suspend");
                managementClient.getControllerClient().execute(op);

                //create the timer while the container is suspended
                start = System.currentTimeMillis();
                timer = bean.getTimerService().createSingleActionTimer(1, new TimerConfig("", false));
                Thread.sleep(1000);

                Assert.assertEquals(0, SuspendTimerServiceBean.getTimerServiceCount());

            } finally {
View Full Code Here

    @Test
    public void testInvocationOnExpiredTimer() throws Exception {

        final CountDownLatch timeoutNotifier = new CountDownLatch(1);
        final CountDownLatch timeoutWaiter = new CountDownLatch(1);
        this.bean.createSingleActionTimer(TIMER_TIMEOUT_TIME_MS, new TimerConfig(null, false), timeoutNotifier, timeoutWaiter);

        // wait for the timeout to be invoked
        final boolean timeoutInvoked = timeoutNotifier.await(TIMER_CALL_WAITING_S, TimeUnit.SECONDS);
        Assert.assertTrue("timeout method was not invoked (within " + TIMER_CALL_WAITING_S + " seconds)", timeoutInvoked);
View Full Code Here

    private void scheduleTwo(final Timer timer) {
    }


    public void createTimerForNextDay(final boolean persistent, final String info) {
        this.timerService.createSingleActionTimer(new Date(System.currentTimeMillis() + (60 * 60 * 24 * 1000)) , new TimerConfig(info, persistent));
        logger.info("Created a timer persistent = " + persistent + " info = " + info);
    }
View Full Code Here

TOP

Related Classes of javax.ejb.TimerConfig

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.