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 8175649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:51:07+00:00 2026-06-06T22:51:07+00:00

in a webapp i want to run an async thread for a long process

  • 0

in a webapp i want to run an async thread for a long process and let the client knows the progress status.
For this i thought to use this abstract class:

public abstract class ThreadProvider implements Runnable{

    protected Thread thread;

    public boolean create() throws SystemException{
        if(thread!=null && thread.isAlive()) throw new SystemException("Il processo è già in esecuzione");
        thread = new Thread(this);
        thread.start();
        return true;
    }
}

And this is my impl:

@Service @Transactional
public class ChiusuraProvider extends ThreadProvider {

    private static Logger gdf = Logger.getLogger("gdf");
    private static Logger log = Logger.getLogger(ChiusuraProvider.class);

    protected Dao dao;
    protected CinetelProvider cinetelProvider;

    @Override
    public void run() {...}
}

Everything works: the thread starts and seems that the autowire works… however Hibernat did not find any session (maybe because i change thread)… how to solve 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-06T22:51:08+00:00Added an answer on June 6, 2026 at 10:51 pm

    @Transactional doesn’t work in this case, see 10.5.1 Understanding the Spring Framework’s declarative transaction implementation.

    You can use programmatic transaction management (TransactionTemplate) inside your run method, or extract transactional logic into separate bean and make it @Transactional.

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

Sidebar

Related Questions

I've been using tomcat7-maven-plugin. I want to run my webapp which connects to the
I want to ask,i tried to call webapp.RequestHandler ,but this handler didn't called: this
I want to run transactions on my Spring webapp which uses Apache Jackrabbit repository.
Ok, so I want to get a webapp running in tomcat (5.5) to run
I want to rewrite a webapp to Python and to use App Engine but
I want to run some tests when my ASP.NET webapp comes online (preferably before
I want to run some kind of Thread continuously in app engine. What the
If we want to run the sample application booking, we need to run this
I have a quite specific problem. I created a webapp and want to have
I want a link to open up another view in my webapp to display

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.