Linked Questions
60 questions linked to/from Get a list of all threads currently running in Java
0 votes
1 answer
154 views
SWT - Is there a way to show running threads [duplicate]
Possible Duplicate: Get a List of all Threads currently running in Java This is just for testing purposes - not production UI Is it possible to set something like a button on my Application's ...
0 votes
0 answers
56 views
How to read all Thread Name, Running on JVM? [duplicate]
I need to read the threads generated by other programs, which are running in the same JVM. I used the following code: long a[] = ManagementFactory.getThreadMXBean().getAllThreadIds(); ThreadInfo[] ...
91 votes
9 answers
27k views
Who is calling the Java Thread interrupt() method if I'm not?
I've read and re-read Java Concurrency in Practice, I've read several threads here on the subject, I've read the IBM article Dealing with InterruptedException and yet there's something I'm simply not ...
54 votes
8 answers
29k views
Is it OK to ignore InterruptedException if nobody calls interrupt()?
If I create my own thread (i.e. not a threadpool) and somewhere I call sleep or any other interruptible method, is it ok to ignore the InterruptedException if I know nobody else in the code is doing ...
24 votes
12 answers
14k views
How to interrupt an Infinite Loop
Though I know it'll be a bit silly to ask, still I want to inquire more about the technical perspective of it. A simple example of an infinite loop: public class LoopInfinite { public static ...
21 votes
8 answers
28k views
Printing thread name using java.util.logging
Is it possible to print the thread name in the log statements generated by java.util.logging.Logger? One alternative is to do something like the following: logger.info(thread.getName() + " some ...
35 votes
4 answers
28k views
How does the JVM terminate daemon threads? or How to write daemon threads that terminate gracefully
Hypothetical scenario: I have a daemon thread responsible for some I/O, the main thread finishes and returns, and the JVM decides to terminate my daemon thread. How does it do so? Interrupt? Finalize?...
10 votes
2 answers
30k views
How to catch exception thrown by another thread in Java? [duplicate]
I'm using a library that creates its own thread and it throws an exception. How can I catch that exception? The exception is thrown on the line marked below: ResourceDescriptor rd = new ...
6 votes
7 answers
596 views
How is a Java application equipped?
I read below from the book < Core Java vol. 1 >: Every Java application starts with a main method that runs in the main thread. In a Swing program, the main thread is short-lived. It ...
7 votes
3 answers
3k views
Thread creation listener
Is it possible to write Thread creation listener in java? For example using aop?! I mean something like this that if my application creates a thread I would like to register this object in my own ...
0 votes
4 answers
5k views
Close all threads except main one
I would like to close all threads that are running (if there are) when my main method is called. public static void main(String[] args) throws Exception { // Close all thread except current one .....
2 votes
1 answer
5k views
Running async jobs in dropwizard, and polling their status
In dropwizard, I need to implement asynchronous jobs and poll their status. I have 2 endpoints for this in resource: @Path("/jobs") @Component public class MyController { @POST @Produces(...
7 votes
3 answers
1k views
Good practice for multi-threading
I have an app where when a "game" stats, it starts a couple different threads. I start the threads like so: Thread thread = new Thread(new Runnable() { public void run() { //... } ...
3 votes
2 answers
7k views
Tomcat8 configuration "maxThreads" does not work
You can find the maxThreads limitation is 350 in below server.xml. Then, I use below command to check current java pid $ps uax | grep tomcat ruyi 25802 0.0 0.0 10436 420 ? Ss ...
2 votes
3 answers
3k views
Java uncaught global exception handler for ALL threads
I asked a question about how to override the default Java Exception handling here and was told the answer here. The question is now : is there a way to generify this handler to all threads without ...