Issue #2726: Fix context tracker for MessageProducer
Change-Id: Id5ba1f100d99909ef0918fb7482bbdc7540aff8e Former-commit-id:4c45d0dae6
[formerly90c6eeb91d
] [formerlyc23e741c65
] [formerly4c45d0dae6
[formerly90c6eeb91d
] [formerlyc23e741c65
] [formerly3daac788ad
[formerlyc23e741c65
[formerly b41584617a29a555a30aa8a0e4e5e7969ed4bfc2]]]] Former-commit-id:3daac788ad
Former-commit-id:6d4451c57b
[formerly6fdf299033
] [formerly 2a9728aba8b1e219ed32404128efe135ee504b07 [formerlya7a0ef9e8d
]] Former-commit-id: 59d43fd3f7955d79475b220ddfd0d201d2f67817 [formerlyfffb17de24
] Former-commit-id:3e0a0adc0f
This commit is contained in:
parent
93600c3a1e
commit
4ad886e01d
2 changed files with 32 additions and 18 deletions
|
@ -375,8 +375,14 @@ public class MessageProducer implements IMessageProducer, InterceptStrategy {
|
|||
* track the thread this context is using for proper dependency
|
||||
* management.
|
||||
*/
|
||||
CamelContext prev = MessageProducer.this.currentThreadContext
|
||||
.get();
|
||||
MessageProducer.this.currentThreadContext.set(context);
|
||||
target.process(exchange);
|
||||
try {
|
||||
target.process(exchange);
|
||||
} finally {
|
||||
MessageProducer.this.currentThreadContext.set(prev);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -385,12 +391,16 @@ public class MessageProducer implements IMessageProducer, InterceptStrategy {
|
|||
* track the thread this context is using for proper dependency
|
||||
* management.
|
||||
*/
|
||||
CamelContext prev = MessageProducer.this.currentThreadContext
|
||||
.get();
|
||||
MessageProducer.this.currentThreadContext.set(context);
|
||||
|
||||
try {
|
||||
target.process(exchange);
|
||||
} catch (Throwable e) {
|
||||
exchange.setException(e);
|
||||
} finally {
|
||||
MessageProducer.this.currentThreadContext.set(prev);
|
||||
}
|
||||
callback.done(true);
|
||||
return true;
|
||||
|
|
|
@ -43,7 +43,7 @@ import com.raytheon.uf.edex.core.IContextStateProcessor;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 17, 2013 2161 bkowal Initial creation.
|
||||
* Mar 11, 2014 2726 rjpeter Graceful shutdown.
|
||||
* Mar 11, 2014 2726 rjpeter Graceful shutdown, don't forward empty pdo lists.
|
||||
* </pre>
|
||||
*
|
||||
* @author bkowal
|
||||
|
@ -99,14 +99,16 @@ public class ModelSoundingPersistenceManager implements IContextStateProcessor {
|
|||
|
||||
if (container != null) {
|
||||
List<PluginDataObject> pdoList = container.getPdos();
|
||||
PluginDataObject[] pdos = pdoList
|
||||
.toArray(new PluginDataObject[pdoList.size()]);
|
||||
try {
|
||||
EDEXUtil.getMessageProducer().sendSync(
|
||||
"modelSoundingPersistIndexAlert", pdos);
|
||||
} catch (EdexException e) {
|
||||
logger.error("Failed to persist " + pdos.length
|
||||
+ " PluginDataObject(s)!", e);
|
||||
if ((pdoList != null) && !pdoList.isEmpty()) {
|
||||
PluginDataObject[] pdos = pdoList
|
||||
.toArray(new PluginDataObject[pdoList.size()]);
|
||||
try {
|
||||
EDEXUtil.getMessageProducer().sendSync(
|
||||
"modelSoundingPersistIndexAlert", pdos);
|
||||
} catch (EdexException e) {
|
||||
logger.error("Failed to persist " + pdos.length
|
||||
+ " PluginDataObject(s)!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
|
@ -125,14 +127,16 @@ public class ModelSoundingPersistenceManager implements IContextStateProcessor {
|
|||
|
||||
protected void storeContainer(ModelSoundingStorageContainer container) {
|
||||
List<PluginDataObject> pdoList = container.getPdos();
|
||||
PluginDataObject[] pdos = pdoList.toArray(new PluginDataObject[pdoList
|
||||
.size()]);
|
||||
try {
|
||||
EDEXUtil.getMessageProducer().sendSync(
|
||||
"modelSoundingPersistIndexAlert", pdos);
|
||||
} catch (EdexException e) {
|
||||
logger.error("Failed to persist " + pdos.length
|
||||
+ " PluginDataObject(s)!", e);
|
||||
if ((pdoList != null) && !pdoList.isEmpty()) {
|
||||
PluginDataObject[] pdos = pdoList
|
||||
.toArray(new PluginDataObject[pdoList.size()]);
|
||||
try {
|
||||
EDEXUtil.getMessageProducer().sendSync(
|
||||
"modelSoundingPersistIndexAlert", pdos);
|
||||
} catch (EdexException e) {
|
||||
logger.error("Failed to persist " + pdos.length
|
||||
+ " PluginDataObject(s)!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue