InterruptibleChannel in the new Jsdk1.4
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Tuesday, February 19, 2002 08:15 AM

I wrote a subclass of Thread which implements the new java.nio.channels Interface InterruptibleChannel . I also have a java.util.Timer class, wich has a TimerTask which run method calls mySubClassOfThread.close() method. If I haven't understood wrongly, my thread is supposed to receive a AsynchronousCloseException , but when I try to catch this exception in the block were I would be when the closed() method is called, I get "Error #: 551 : catch is unreachable at line 113, column 5" in Jbuilder. I have a similar situation if I try to call the mySubClassOfThread.interrupt() method, with which I should expect a ClosedByInterruptException . All this is b   More>>

I wrote a subclass of Thread which implements the new java.nio.channels
Interface InterruptibleChannel
.
I also have a java.util.Timer class, wich has a TimerTask which run method calls mySubClassOfThread.close() method.

If I haven't understood wrongly, my thread is supposed to receive a AsynchronousCloseException , but when I try to catch this exception in the block were I would be when the closed() method is called, I get "Error #: 551 : catch is unreachable at line 113, column 5" in Jbuilder. I have a similar situation if I try to call the mySubClassOfThread.interrupt() method, with which I should expect a ClosedByInterruptException .

All this is because I am not calling any sleep() or wait() methods, so without the interface the interrupt() method wouldn't have any effect on my thread, am I right?.

The project is configured to use Jsdk1.4, so that is not the problem.
What am I doing wrong?.

If you can't figure out (which I doubt since your programming skills and experience should be astronomically greater than mine), is there a simpler way to close a thread from outside it, like when a "timeout" occurs?. Thanks in advance.    <<Less
About | Sitemap | Contact