Issue #2726: Fix context tracker for MessageProducer
Change-Id: Id5ba1f100d99909ef0918fb7482bbdc7540aff8e Former-commit-id:3daac788ad
[formerlyc23e741c65
[formerly b41584617a29a555a30aa8a0e4e5e7969ed4bfc2]] Former-commit-id:c23e741c65
Former-commit-id:90c6eeb91d
This commit is contained in:
parent
0bf7593ccd
commit
4c45d0dae6
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);
|
||||
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,6 +99,7 @@ public class ModelSoundingPersistenceManager implements IContextStateProcessor {
|
|||
|
||||
if (container != null) {
|
||||
List<PluginDataObject> pdoList = container.getPdos();
|
||||
if ((pdoList != null) && !pdoList.isEmpty()) {
|
||||
PluginDataObject[] pdos = pdoList
|
||||
.toArray(new PluginDataObject[pdoList.size()]);
|
||||
try {
|
||||
|
@ -109,6 +110,7 @@ public class ModelSoundingPersistenceManager implements IContextStateProcessor {
|
|||
+ " PluginDataObject(s)!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
// fail safe so store thread doesn't fail
|
||||
logger.error(
|
||||
|
@ -125,8 +127,9 @@ public class ModelSoundingPersistenceManager implements IContextStateProcessor {
|
|||
|
||||
protected void storeContainer(ModelSoundingStorageContainer container) {
|
||||
List<PluginDataObject> pdoList = container.getPdos();
|
||||
PluginDataObject[] pdos = pdoList.toArray(new PluginDataObject[pdoList
|
||||
.size()]);
|
||||
if ((pdoList != null) && !pdoList.isEmpty()) {
|
||||
PluginDataObject[] pdos = pdoList
|
||||
.toArray(new PluginDataObject[pdoList.size()]);
|
||||
try {
|
||||
EDEXUtil.getMessageProducer().sendSync(
|
||||
"modelSoundingPersistIndexAlert", pdos);
|
||||
|
@ -135,6 +138,7 @@ public class ModelSoundingPersistenceManager implements IContextStateProcessor {
|
|||
+ " PluginDataObject(s)!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checking in a model sounding container makes it available for the store
|
||||
|
|
Loading…
Add table
Reference in a new issue