ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Capture external Java procedure exception inside Flow ESQL

Post new topic  Reply to topic
 Capture external Java procedure exception inside Flow ESQL « View previous topic :: View next topic » 
Author Message
sunny_30
PostPosted: Fri Jun 06, 2014 8:25 pm    Post subject: Capture external Java procedure exception inside Flow ESQL Reply with quote

Master

Joined: 03 Oct 2005
Posts: 258

I have a message flow invoking external Java procedure. If an exception occurs in the Java, the error string needs to be captured inside Flow ESQL.

I set the Java procedure to be executed inside ESQL Handler block, so when an exception occurs, its invoking another Java method which returns the error string in a static variable (I cannot use an instance variable since the external function has to be static). This approach works but all isnt well.

In heavy traffic, the static (EG JVM scope) variable data is getting overwritten by another instance. Can someone please suggest a solution ? Thank you
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Jun 06, 2014 10:28 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Have you thought about using a ThreadLocal variable to make it thread safe?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kash3338
PostPosted: Sat Jun 07, 2014 5:54 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

How about Atomic Variables in Java? You can give a try.
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Sat Jun 07, 2014 11:01 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

kash3338 wrote:
How about Atomic Variables in Java? You can give a try.


You are forgetting that java.lang.String is not a primitive and that it as such it would not qualify... maybe as a reference... and then what's the incessant stuff with internal loops?

Better in this particular case to use a ThreadLocal variable... as you want each thread to have it's own copy and not change/see the value of a different thread...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
sunny_30
PostPosted: Sun Jun 08, 2014 12:27 am    Post subject: Reply with quote

Master

Joined: 03 Oct 2005
Posts: 258

Thank you both for the Help. Implemented ThreadLocal. Tried Atomic as well, little complicated but it seems to work as well

Apart from capturing exceptions, there was another issue I was able to fix using ThreadLocal. JDBC connection value was stored as JCN static variable (not threadsafe) accessed from another class where external JDBC methods are defined, invoked using ESQL. I couldn't merge JCN class and the JDBC methods class. All external methods, variables involved had to be defined as static, otherwise not working. ThreadLocal helped keep the JDBC connections local to the flow thread.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Capture external Java procedure exception inside Flow ESQL
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.