Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8958729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:16:53+00:00 2026-06-15T15:16:53+00:00

in the JSF-2 application I’m working on, I need to start a server side

  • 0

in the JSF-2 application I’m working on, I need to start a server side Timer when a user does an action.
This timer must be related to the application itself, so it must survive when the user session is closed.
To solve this problem, I thought to use java.util.Timer class instantiating the timer object in an Application scoped bean.
Could it be a good solution? Are there other better ways to achive this? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:16:54+00:00Added an answer on June 15, 2026 at 3:16 pm

    No ejb-container

    If your container doesnt have ejb capabilities (tomcat, jetty etc..), you can go with quartz scheduler library: http://quartz-scheduler.org/

    They also has some nice code samples: http://quartz-scheduler.org/documentation/quartz-2.1.x/examples/Example1

    EJB 3.1

    If your app-server have a EJB 3.1 (glassfish, Jboss), there is a java ee standard way of creating timers. Mainly look into the @Schedule and @Timeout annotations.

    Something like this might cover your usecase (method annotated @Timeout will be invoked when timer runs out)

    import javax.annotation.Resource;
    import javax.ejb.Stateless;
    import javax.ejb.Timeout;
    import javax.ejb.Timer;
    import javax.ejb.TimerConfig;
    import javax.ejb.TimerService;
    
    @Stateless
    public class TimerBean {
        @Resource
        protected TimerService timerService;
    
        @Timeout
        public void timeoutHandler(Timer timer) {
            String name = timer.getInfo().toString();
            System.out.println("Timer name=" + name);
        }
    
        public void startTimer(long initialExpiration, long interval, String name){      
            TimerConfig config = new TimerConfig();
            config.setInfo(name);
            config.setPersistent(false);
            timerService.createIntervalTimer(initialExpiration, interval, config);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working JSF application that allows a user to enter their name,
i am working in JSF Application and in this application using some code i
In my JSF application, I need to redirect the user from Page A to
In my web jsf application, I display different messages to the user using this
I made an jsf application.This application has a menu containing start,stop buttons.When start is
I have created a simple JSF application, now must to connect to SQL Server
I try to run jsf application in myeclipse using jboss web server and following
I was trying out a simple JSF application, in which I need to check
I am getting this error when ever deploying my jsf application java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config at
I have a small JSF application where the user is required to enter some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.