Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By alexandroscgb

Thread: Monitoring java threads from another JVM

  1. #1
    alexandroscgb is offline Member
    Join Date
    Oct 2012
    Posts
    3
    Rep Power
    0

    Default Monitoring java threads from another JVM

    Hi all.
    I have this web app in Glassfish which, among other things, monitors consultations in some DB. It's a JEE-EAR app, three layers. Pretty boring until now. Now, there's another WAR-app on Tomcat that processes files through threads. These threads represent an Excel file processed one row at a time.
    I need to know when one of those threads are created, when they're alive and when they're terminated, from the Glassfish app.
    I need to monitor these batch processes.

    I think I could insert the thread ID from the tomcat app in some DB and when it dies, delete it. The glassfish app would query that BD and see if there is one of those batch processes running.
    I understand that a thread ID can be recycled but I can find a way to make every process unique.
    My first question, would this be viable?

    My second question is, could I uniquely set the thread name and then ask for it from the glassfish app to the tomcat-app process thread set? I mean, without a DB in the middle?


    Thanks in advance.

  2. #2
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,105
    Rep Power
    6

    Default Re: Monitoring java threads from another JVM

    You are thinking way too low level. You don't have threads, you don't want to monitor threads from your Glassfish server. Let me rephrase it a bit.

    - you have individually operating classes that do things and stuff on their own. What they do is really not that interesting for the design of this solution
    - you want to know what those individually operating classes are doing
    - you want to know that... (ominous horror movie music) ... from another application in another virtual machine entirely

    So lets call the webapp running in Tomcat application A and the monitoring application in Glassfish application B.

    step 1: make it so application A can TELL what those individually operating classes are doing. I mean if not even A knows what it is doing, then how can any other application?
    step 2: make sure that it can tell that to the outside world; using for example RESTful webservices is an option but there are many more
    step 3: make it so application B can consume said webservice and get the information from A

    No madness about threading, application B shouldn't care that they are threads. You just want to know things and stuff that application A is doing, so application A will have to be able to communicate that. Sounds a lot simpler, right?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    alexandroscgb is offline Member
    Join Date
    Oct 2012
    Posts
    3
    Rep Power
    0

    Default Re: Monitoring java threads from another JVM

    thank you, you're right, a lot simpler!
    gimbal2 likes this.

Similar Threads

  1. Java monitoring tools
    By setevoy in forum New To Java
    Replies: 8
    Last Post: 09-13-2013, 04:31 PM
  2. How i can set one ubuntu server for java monitoring
    By marturo77 in forum Advanced Java
    Replies: 0
    Last Post: 09-21-2012, 10:39 PM
  3. asset monitoring in snmp using java
    By annette in forum Forum Lobby
    Replies: 1
    Last Post: 05-07-2012, 12:09 PM
  4. Monitoring open windows with java
    By Srt252 in forum New To Java
    Replies: 3
    Last Post: 06-18-2008, 06:45 AM
  5. Which concept used in java for monitoring the printer
    By kalinga2k4 in forum Networking
    Replies: 1
    Last Post: 06-14-2008, 01:25 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •