While using NetComponents library on HP-UX 11i platform, even after calling
close() on FTPClient object, the TelnetInputStream thread does not always
terminate; and blocks on wait() for ever. The patch below addresses this
issue. I've tested this fix on Windows and HP-UX and found it OK. Can
someone apply this patch? Thanks!!
--- TelnetInputStream.java.orig Thu Sep 19 15:48:50 2002
+++ TelnetInputStream.java Thu Sep 19 15:48:38 2002
@@ -39,7 +39,7 @@
_STATE_WONT = 3, _STATE_DO = 4, _STATE_DONT = 5, _STATE_SB = 6,
_STATE_SE = 7, _STATE_CR = 8;
- private boolean __hasReachedEOF, __isClosed;
+ private volatile boolean __hasReachedEOF, __isClosed;
private boolean __readIsWaiting;
private int __receiveState, __queueHead, __queueTail, __bytesAvailable;
private int[] __queue;
@@ -300,12 +300,12 @@
// interrupt a system read() from the interrupt() method.
super.close();
- synchronized(__queue) {
__hasReachedEOF = true;
+ __isClosed = true;
if(__thread.isAlive()) {
- __isClosed = true;
__thread.interrupt();
}
+ synchronized(__queue) {
__queue.notifyAll();
}
/*
@@ -332,10 +332,10 @@
} catch(InterruptedIOException e) {
synchronized(__queue) {
__ioException = e;
- __queue.notify();
+ __queue.notifyAll();
try {
//System.out.println("THREAD WAIT B");
- __queue.wait();
+ __queue.wait(100);
//System.out.println("THREAD END WAIT B");
} catch(InterruptedException interrupted) {
if(__isClosed)
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>