0

I'm using one thread which i set a name "LegacyMsgConsumer-Main-Thread" to get messages from a MsgQueue , and then put those inside a ThreadPoolExecutor to handle. this service works ok the at the beginning(I can see from the mornitor showing that is consuming messages), but after several hourse, the monitor showing the message consumed is 0. I've dumped the thread two ways : jstack and jmap . i've check both thread dump : enter image description here Those Legacy-Consumer-Pool is the ThreadPoolExecutor that handle messages, there're waiting for message to handle, but i can't find the thread that getting message from MessageQueue(which i named LegacyMsgConsumer-Main-Thread ). here is my code .

  1. set a name to the message getting thread.

  2. getting message from a messageQueue , this runs in a while loop

  3. count the number of empty message

  4. sleep the thread , sleep time is based on the count of empty message.

  5. submit valid message to the ThreadPoolExecutor to handle.

enter image description here

my question is : where is the LegacyMsgConsumer-Main-Thread thread ? Did it being Garbage Collected ?

Adams.H
  • 1,603
  • 4
  • 20
  • 29
  • Have you tried to place a stacktrace in the catch(InterruptedException) block to see if this happens sometimes? – Rene M. Apr 19 '17 at 14:05
  • 1
    Yeah I'd guess that you swallowed an exception someplace in the thread that you are missing. Put a try-catch that catches everything at the very top method of that thread, and print out and log any exception it throws. – markspace Apr 19 '17 at 14:07
  • ok ,i'll add it , i will update the question if i get the error . – Adams.H Apr 19 '17 at 14:07
  • You can only leave that loop by an exception, it looks like, so check your exception logs. – M. Prokhorov Apr 19 '17 at 14:15

0 Answers0