× 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.



That makes sense and agrees with what I was saying. DEQW is not a java
wait() and therefore Thead.interrupt() is not going to throw an
exception in the controlled thread.

If this were a purely i5OS ILE program, the only way to knock the
process off the DEQW would be to have the other thread write something
to the data queue. That data queue entry would tell the thread sitting
on the data queue to end. You could do the same in your java app. The
controlling thread writes a dataqueue entry that the controlled thread
reads off the dataqueue telling it to end. Pretty simple and it'll work
native or non.

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Neill Harper
Sent: Thursday, January 15, 2009 3:25 PM
To: 'Java Programming on and around the iSeries / AS400'
Subject: RE: Thread waiting on a data queue ... doesn't respond
tointerrupt()??

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

--
IBM i on Power - For when you can't afford to be out of business
--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/java400-l.

--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/java400-l.




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.