Home Discussion Discuss: Shutting down threads cleanly,java tutorial,java tutorials

  • Interesting but not enoughDissident September 9, 2011 at 9:03 PM

    I really like your tutorial but I don't think it's good enough to kill threads that you don't want anymore. As far as I know .interrupt() only works for threads that are sleeping. Example: if you use a while(true){} loop and you apply interrupt it wouldn't work. I'm just looking for a Thread.stop() replacement. Nevertheless thank you for your post.

  • Socket + ThreadsTiago Rosolen October 21, 2011 at 11:35 PM

    Very good article my friend, but the .interrupt() doesn't work very well when you have a IO operation on the run() method. Somehow the VM seems to wait for the IO operation to end and keep the thread on memory for a while. This can couse terible JVMMemoryOverflow problems. But thaks again for this material, I loved. Best regards.

  • finally !Chirag October 18, 2012 at 5:06 PM

    Why not use "try" with "finally" instead of catching and rethrowing exception to clean up the stuff while exiting

  • DpaMhVCcjOCathleen June 13, 2013 at 3:10 AM

    Tocuhdown! That's a really cool way of putting it!

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
General

Shutting down threads cleanly,java tutorial,java tutorials
Shutting Down Threads Cleanly 2002-09-16 The Java Specialists' Newsletter [Issue 056] - Shutting down threads cleanly Author: Dr. Heinz M. Kabutz... My thoughts on shutting down threads is based on ideas I gleaned from those two 

Programming Tutorials

Tutorial, Java Tutorials
Tutorials Here we are providing many tutorials on Java related... Java Testing JSON Tutorial... NIO Java NIO Tutorials 

General

Java - JDK Tutorials
Java - JDK Tutorials   Deadlocks in Java In this tutorial you....    Java Compile Time Constants This tutorials is all... for Java 1.4  Assertion In Java In this tutorial we are going 

Java-Tutorials

Thread Deadlocks - Java Tutorials
Thread Deadlock Detection in Java Thread deadlock relates to the multitasking. When two threads have circular dependency on a synchronized, deadlock.... In this technique, we use data structure(For example-map, graph etc) to note down 

Java Beginners

threads
threads  what are threads? what is the use in progarmming 

General

Counting bytes on Sockets,java tutorial,java tutorials
Counting bytes on Sockets 2002-10-09 The Java Specialists' Newsletter [Issue... to the 58th edition of The Java(tm) Specialists' Newsletter sent to 4814 Java... - they are still my #1 priority :-) and I will fit them in inbetween writing Java code 

Java Beginners

interfaces,exceptions,threads
: Exception Handling in Java   Threads A thread is a lightweight process which... with multiple threads is referred to as a multi-threaded process. In Java Programming...interfaces,exceptions,threads  SIR,IAM JAVA BEGINER,I WANT KNOW 

Java Beginners

threads
 

Java Beginners

threads
 

Java Interview Questions

Threads
 

Java Beginners

Threads
 

Java Interview Questions

Threads
 

Java Interview Questions

Threads
 

Java Interview Questions

java threads - Java Interview Questions
for Java threads in the range of 1 to 10. Following is the constaints defined... of Thread at http://www.roseindia.net/tutorial/java/thread/priority.html Thanks...java threads  How can you change the proirity of number of a thread 

General

OutOfMemoryError Warning System - Java Tutorials
of The Java(tm) Specialists' Newsletter. Down here at the end of Africa, tech-toys... of how threads should be written. Our next Java course is scheduled from...OutOfMemoryError Warning System 2004-07-20 The Java Specialists' Newsletter 

Training

Java Training and Tutorials, Core Java Training
Java Training and Tutorials, Core Java Training Introduction to online Java tutorials for new java programmers.  Java is a powerful object...: Arrays:  Java Array Tutorial 

Blog

Site map - C Tutorials
Tutorials | Dojo Tutorials   | Java Script Tutorial | CVS Tutorial... Tutorials | JEE 5 Tutorial | JDK 6 Tutorial | Java UDP Tutorial | Java Threading Tutorial | Java 5 Tutorials | EJB Tutorial | Jboss 3.0 

General

Java Swing Tutorials
Java Swing Tutorials       Java Swing tutorials -  Here you will find many Java Swing... and you can use it in your program. Java Swing tutorials first gives you brief 

General

Initialising Fields before Superconstructor call - Java Tutorials
Initialising Fields before Superconstructor call 2004-03-19 The Java... of The Java(tm) Specialists' Newsletter. My last newsletter caused some... I first learned Java was when Bruce Eckel pointed out in his book 

Java Tips and Examples

Threads
Threads Basic Idea Execute more than one piece of code at the "same... time slicing. Rotates CPU among threads / processes. Gives.... Threads vs Processes Multiple processes / tasks Separate programs 

Development process Questions

threads in java
threads in java  how to read a file in java , split it and write into two different files using threads such that thread is running twice 

Java Beginners

threads and events
threads and events  Can you explain threads and events in java for me. Thank you.   Java Event Handling Java Thread Examples 

General

Making Exceptions Unchecked - java tutorial,java tutorials
and Unchecked Exceptions in java and how to handle it. The Exception is a condition which indicates error in your code. Types of built-in exception in Java Given below types of built-in exception in java : 1. Unchecked Exception 2. Checked 

General

The link to the outer class,java tutorial,java tutorials
(); } } Output C:\Program Files\Java\jdk1.6.0_18\bin>javac SimpleInnerClass .java C:\Program Files\Java\jdk1.6.0_18\bin>java SimpleInnerClass display : x = 100   

Java Interview Questions

Java threads
Java threads  What are the two basic ways in which classes that can be run as threads may be defined 

Ajax Examples

jQuery - jQuery Tutorials and examples
Tutorial Collection of more than 100 tutorials on jQuery.   Server... with sliding effect.   jQuery Drop Down Menu In this JQuery tutorial... jQuery - jQuery Tutorials and examples    

Java Beginners

disadvantage of threads
is the disadvantage of threads?   hello, The Main disadvantage of in threads... disadvantage of Threads. Let?s discuss the disadvantages of threads. The global... java libraries are not thread safe. So, you should be very care full while using 

Java Beginners

Sync Threads
Sync Threads  "If two threads wants to execute a synchronized method in a class, and both threads are using the same instance of the class to invoke...://www.roseindia.net/java/thread/SynchronizedThreads.shtml Thanks 

Java Beginners

threads in java
threads in java  iam getting that the local variable is never read in eclipse in main classas:: class Synex4{ public static void main(String args[]){ Test1 ob1=new Test1(); //local variable never read 

General

NIO Tutorials, Java nio tutorial, Java nio package tutorial
NIO Tutorial - Java NIO Tutorials In this section we will discuss about the Sun java nio package. This nio tutorials will help you learn... of NIO tutorials. NIO Tutorials How to get bytes from ByteBuffer in java