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 » Thread safety of a JavaComputeNode

Post new topic  Reply to topic
 Thread safety of a JavaComputeNode « View previous topic :: View next topic » 
Author Message
digital17
PostPosted: Wed Sep 26, 2007 12:30 pm    Post subject: Thread safety of a JavaComputeNode Reply with quote

Newbie

Joined: 26 Sep 2007
Posts: 5

I have a Java compute node (extending from MbJavaComputeNode) coded the usual way by implementing the evaluate method. My question is how is the broker calling this node? Does it create a new instance of it everytime a message flows through this node? Or is it like a servlet that shouldnt have instance variables because there is only one instance of it shared across threads?

If this is like a servlet, are there methods I can implement in my own code in order to initiate initialization and cleanup of the class? I couldn't find the API documentation of MbJavaComputeNode in the toolkit or the online API javadoc.

Thanks.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Sep 26, 2007 1:03 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It's not anything like a servlet.

JCN node lifecycle is complicated, and I don't feel like going into it right now. You can look at the InfoCenter documentation on the lifecycle of a Java User Defined Input node and make some inferences from that.

Do not assume that your node will be instantiated for every call to execute().

Do not assume that your node will only ever be instantiated once for the lifetime of a flow.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
digital17
PostPosted: Wed Sep 26, 2007 1:42 pm    Post subject: Reply with quote

Newbie

Joined: 26 Sep 2007
Posts: 5

I went to the information center to look at what you mentioned and saw the ondelete method.
Can I implement the onDelete method in my JavaComputeNode for cleanup before the node is destroyed? I need to free up resources like a socket connection.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Sep 26, 2007 1:52 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Are you trying to implement JDBC connection pooling?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
digital17
PostPosted: Wed Sep 26, 2007 2:00 pm    Post subject: Reply with quote

Newbie

Joined: 26 Sep 2007
Posts: 5

No. Just HTTP connections. Otherwise, I might have to change all of this and use jakarta's HTTPClient that does this already.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Sep 26, 2007 2:03 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

...

Why can't you use an HTTPRequest node?

Why do you need to leave an HTTP connection open across multiple invocations of a JavaCompute node?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
digital17
PostPosted: Wed Sep 26, 2007 2:10 pm    Post subject: Reply with quote

Newbie

Joined: 26 Sep 2007
Posts: 5

We are having problems with the HttpRequestNode and the headers of an old service that the HttpRequestNode doesn't handle. The vendor for that service is trying to fix that but other things need to be fixed as well. So this is an interim solution.

We want to do connection pooling for performance. This is a high volume app.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Sep 26, 2007 2:21 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Okay... That's much more reasonable than I'd feared.

I haven't tried using onDelete(). It should work, though.

You may want to rely on POJOs to handle all your connections/connection pools, though... and put the jar files for those in shared-classes.

Then you will have one pool for the entire EG, rather than one pool for each JCN instance.

I'm doing something similar with JDBC connection pooling using the Apache db-commons classes.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
digital17
PostPosted: Thu Sep 27, 2007 5:53 am    Post subject: Reply with quote

Newbie

Joined: 26 Sep 2007
Posts: 5

Thanks!
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 » Thread safety of a JavaComputeNode
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.