File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

interrupt doesn't interrupt?

 
Rebecca Witmer
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following small method in my code. spt is a thread. Why doesn't isInterrupted() always return true? It always prints "false".
Rebecca

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

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

segmentPlaying = false;
}
}
 
David Harkness
Ranch Hand
Posts: 1646
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the JavaDocs for Thread.interrupt():Is that Thread currently sleeping or waiting?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic