Author |
Message
|
paustin_ours |
Posted: Mon Mar 24, 2014 6:44 am Post subject: message flow thread |
|
|
Yatiri
Joined: 19 May 2004 Posts: 667 Location: columbus,oh
|
when a message flow is deployed it creates a thread in the EG. With only one instance of the flow running. Is this the only thread that will be alive for the entire time of the life of the flow.
If i stop/start the flow, this would create a new thread in my understanding but is it correct in assuming that a deployed flow will always be running as that one thread. If correct, does this hold good even when i use a JCN?
ANy thoughts? |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Mar 25, 2014 2:52 am Post subject: Re: message flow thread |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
paustin_ours wrote: |
when a message flow is deployed it creates a thread in the EG. With only one instance of the flow running. Is this the only thread that will be alive for the entire time of the life of the flow.
If i stop/start the flow, this would create a new thread in my understanding but is it correct in assuming that a deployed flow will always be running as that one thread. If correct, does this hold good even when i use a JCN?
ANy thoughts? |
This begs the question as to why do you need that information. What exactly are you trying to do?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
paustin_ours |
Posted: Wed Mar 26, 2014 12:14 pm Post subject: |
|
|
Yatiri
Joined: 19 May 2004 Posts: 667 Location: columbus,oh
|
There is usage of threadlocal variable inside JCN to store database connection and reuse it until a batch insert is done in one of our applications. Trying to think of scenarios this could cause problems.
First wanted to make sure that a message flow is always that one thread unless otherwise additonal instances are used. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Mar 27, 2014 5:13 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
ThreadLocal keeps your information thread safe, that is unique within the flow INSTANCE.
You need to use this for well known "unsafe" implementations like DateFormat etc...
I am not sure that your use of ThreadLocal does what you intend...
Obviously it would be better to have a commit every x many messages in your batch and record the last commit and record # in a message on a queue? This way you could restart the batch at the last commit...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Tibor |
Posted: Thu Mar 27, 2014 5:33 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
I'm not a Java guru, but did you mind using a singleton class for the connection? |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Mar 27, 2014 5:37 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Tibor wrote: |
I'm not a Java guru, but did you mind using a singleton class for the connection? |
Unpractical as you will need multiple instances of the connection throughout the life cycle of the flow instance... (Think differences between a transacted vs non transacted session in the same flow... )  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|