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

  • Home
  • SEARCH
  • 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 6635975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:07:32+00:00 2026-05-25T23:07:32+00:00

I am creating a JBoss server to deploy a java application which will be

  • 0

I am creating a JBoss server to deploy a java application which will be a REST-like servlet taking data from requests and placing them into a SQL database.

My main question: Is it possible to set up a class on the JBoss server which is not run based on requests but is more like a main loop. I.e. just a loop which will “sleep” then check some information and either do something or sleep again.

Basically what I am trying to do is write a bunch of data to a file, once that file fills up to a certain point, write it all at once to the database to reduce connection overhead.

My best guess is that I could write any kind of class with a loop and have it run in the way I want(as long as my “sleep” technique was correct to allow for the servlet on the same JBoss time to run).

What I don’t know though is how to get that main loop to run constantly; Just call it in the constructor?? The only way I know how to have things run on the server currently is to have a mapping set up in the web.xml and actively make a web page request information from the server…
Is there a better(read easier) service than JBoss and java for something like that

Thanks in advance, I have searched pretty hard for an explanation of something like this but it seems I am missing the right keyword…

  • 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-05-25T23:07:33+00:00Added an answer on May 25, 2026 at 11:07 pm

    Have a look at @Startup and @Singleton beans.

    In short, you can write something like this:

    @Startup @Singleton 
    public class MainLoopBean {
    
       @PostConstruct   
       public void mainLoop() {   
       }
    
    }
    

    Ideally you should couple this with the timer service. When some amount of work is done and you want to pause, just schedule the method to be invoked later and return.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a spring web application running on JBoss which is creating a csv
Creating a server-side socket will fail if I'm trying to use the same port
We're creating a web system using Java and Servlet technology (actually Wicket for the
Hello i am creating a J2ME application in which i need to call a
I am using a POJO (Non-EJB) class inside my JBoss server and creating multiple
This error is not appearing when I m manually removing hibernate-validator.jar from JBoss Application
I'm creating a web-service written in Java and hosted on JBoss AS. I'm not
I want to use JBoss tools in Eclipse to generate java code from DDL.
In JBoss AS 7, is there a way to interactively deploy an application? In
When creating a web application, and lets say you have a User object denoting

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.