× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



David

I asked this a few months ago and had to get an answer from the guys who run
JTOpen, they told me that when using the native toolbox the interrupt
basically doesn't work as there is no way for a java thread to interrupt a
DEQW operation.

The solution was to set the AS400 connection object to mustusesockets and
force the dataqueue operations throught the dataq server

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of David Gibbs
Sent: 07 May 2009 17:20
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 set
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 thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.