|
-----Original Message-----set
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-
bounces@xxxxxxxxxxxx] On Behalf Of David Gibbs
Sent: Thursday, May 07, 2009 9:20 AM
To: Java Programming on and around the iSeries / AS400
Subject: Thread waiting on a data queue ... doesn't respond to
interrupt()??
Folks:
Has anyone ever seen something like this?
I've got a thread that's listening on a data queue ... timeout value is
to -1 (wait forever).
The thread is sent an interrupt message ... which should throw an
InterruptedException that I catch ... but sometimes it doesn't.
The code that is reading the data queue looks like this:
----------
int waitTime = -1;
try {
while(true) {
try {
DataQueueEntry entry = changeQueue.read(waitTime);
if (entry != null) {
processEntry(entry);
}
} catch (AS400SecurityException e) {
e.printStackTrace();
} catch (ErrorCompletingRequestException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (IllegalObjectTypeException e) {
e.printStackTrace();
} catch (ObjectDoesNotExistException e) {
e.printStackTrace();
}
}
} catch (InterruptedException e) {
System.out.println("Thread was interrupted, exit");
}
----------
The method that is trying to interrupt the thread is something like this:
----------
monitorThread.interrupt();
try {
monitorThread.join();
} catch (InterruptedException e) {
logException(e);
}
----------
But it the join() method never seems to return.
I'm not 100% sure, but I think this has only been seen when the program is
running on the iSeries ... not on a PC.
Any thoughts?
Thanks!
david
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.