This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes interrupt doesn't interrupt? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "interrupt doesn Watch "interrupt doesn New topic

interrupt doesn't interrupt?

Rebecca Witmer
Ranch Hand

Joined: Sep 10, 2004
Posts: 46
I have the following small method in my code. spt is a thread. Why doesn't isInterrupted() always return true? It always prints "false".

public void stopSegment( ) {
if (segmentPlaying){
segmentTimer.stop( );

boolean interrupted = spt.isInterrupted();
spt = null;
System.out.println("Spt is interrupted is " + interrupted);

segmentPlaying = false;

SCJP 1.4
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
From the JavaDocs for Thread.interrupt():Is that Thread currently sleeping or waiting?
Have you checked out Aspose?
subject: interrupt doesn't interrupt?
It's not a secret anymore!