• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Managing background threads in JBoss

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I can't really find anything definitive on this online, so I thought it might be time for a forum post on the subject.

Does anyone know if its possible to start a number of background threads in JBoss? Currently we have a web application that gets deployed on JBoss, which depends upon two running background threads to perform various tasks - the independant threads have to be started and stopped through some custom shell scripts, and I'm looking for a better way of handling this. If there were some way to start the threads in JBoss, and manage them remotely (perhaps through the use of MBeans?) then I think this would be a reasonable improvement in our application architecture.

I was wondering if anyone had done something similar at any point, or if anyone has any tutorials stashed away anywhere on this subject.

Cheers

Jon
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

perhaps through the use of MBeans?



I guess, yes. Going by what you mentioned, you want the threads to be doing some background activity for your application. MBeans might be a option. They will be deployed as services and will be started when JBoss starts. So any activity that you would want to do could be done through these MBeans. Are you looking for some examples for MBeans on JBoss?

Also, could you provide more details as to what these threads (or MBeans) will be doing in the background? Reason why i ask is, if your MBean is expected to do some activities related to database through datasources/EJBs, you will have to ensure that the EJBs/datasources are started before your MBean is started. You can definitely configure these things, but i dont want to mention those details here unless those are releveant for your use case
[ June 20, 2007: Message edited by: Jaikiran Pai ]
 
Jon Poulton
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jaikiran Pai:
I guess, yes.



OK. I'm guessing then, that this isn't something which is easily done, or at least, not done often. Perhaps there is a reason for that?

There are two threads in question - one is involved in storing database text in Lucene indexes and the other is an RMI thread that allows Lucene searches across multiple boxes (a distributed search). The first thread periodically connects to the database, checks for new rows in one table, and indexes any new text it finds with into a directory of Lucene indexes.

I'm wondering if we shouldn't be looking at a completely different approach. Perhaps we should have a multithreaded "server" (the RMI thread, and the Lucene thread) running on each box, and only 1 JBoss box handling HTTP requests only?

Jon
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm guessing then, that this isn't something which is easily done, or at least, not done often. Perhaps there is a reason for that?



Based on your first post, i did not know what you were trying to do with the threads.

The first thread periodically connects to the database, checks for new rows in one table, and indexes any new text it finds with into a directory of Lucene indexes.



JBoss has a scheduler service which you could use:
Scheduler Service

and the other is an RMI thread that allows Lucene searches across multiple boxes (a distributed search).



I still think this should be possible using MBeans (i dont have a personal experience, though).
 
Willie Smits increased rainfall 25% in three years by planting trees. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic