IBM MQ Series Exception question....10 Duke Dollars!!!
I have a problem here at work I need to solve...There are threads running and connecting to an IBM MQ Series. I am not connecting to a MQ Series box but that is OK. Here is the problem and the code.
If the MQ Manager or Queue is unavailable (i.e. through incorrect properties file settings or that MQ is not setup), the MQMessageSender class raises a NullPointerException and the thread terminates. This is a problem because the java process still actually runs, so there may be occasions where the messages are but there are not controllers to process the message. This can result in reduced performance, or if no threads are left, missing messages.
I need to know what code will work for this scenario:
I want the exception to be displayed but not stop the threads from running, meaning display the nullpointerexception but keep the threads running.
Here is the current code I have to work with...
Runnable r = new Runnable() {
public void run() {
try {
runWork();
} catch (Exception x) {
// in case ANY exception slips through
x.printStackTrace();
}
}
};
internalThread = new Thread(r);
internalThread.start();
PLEASE HELP....there is 10 DUKE DOLLARS AVAILABLE FOR THIS ONE....
THANKS....
~A~
[1317 byte] By [
bigashisha] at [2007-9-27 23:12:02]

> I have a problem here at work I need to solve...There
> are threads running and connecting to an IBM MQ
> Series. I am not connecting to a MQ Series box but
> that is OK. Here is the problem and the code.
>
> If the MQ Manager or Queue is unavailable (i.e.
> through incorrect properties file settings or that MQ
> is not setup), the MQMessageSender class raises a
> NullPointerException and the thread terminates. This
> is a problem because the java process still actually
> runs, so there may be occasions where the messages are
> but there are not controllers to process the message.
> This can result in reduced performance, or if no
> threads are left, missing messages.
>
> I need to know what code will work for this scenario:
> I want the exception to be displayed but not stop the
> threads from running, meaning display the
> nullpointerexception but keep the threads running.
>
> Here is the current code I have to work with...
>
>
> Runnable r = new Runnable() {
> public void run() {
> try {
> runWork();
> } catch (Exception x) {
> // in case ANY exception slips through
> x.printStackTrace();
> }
> }
> };
> internalThread = new Thread(r);
> internalThread.start();
>
>
> PLEASE HELP....there is 10 DUKE DOLLARS AVAILABLE FOR
> THIS ONE....
>
> THANKS....
> ~A~
put a while loop in the run method enclosing the try catch block.