Skip to content

Commit

Permalink
Add review sugessions
Browse files Browse the repository at this point in the history
  • Loading branch information
chanikag committed Aug 23, 2023
1 parent 98d8a14 commit 518f56d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.synapse.config;

import org.apache.axiom.om.OMElement;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.SequenceFlowObserver;
Expand Down Expand Up @@ -63,7 +64,7 @@ public static List<SequenceFlowObserver> loadObservers() {

if (observerElem.getAttribute(CLASS_Q) != null) {
String className = observerElem.getAttributeValue(CLASS_Q);
if (!"".equals(className)) {
if (StringUtils.isNotBlank(className)) {
SequenceFlowObserver observer = createObserver(className);
if (observer != null) {
observers.add(observer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public boolean mediate(MessageContext synCtx, int mediatorPosition) {
// to pass it on; else, do nothing -> i.e. let the parents state flow
setEffectiveTraceState(synCtx);
int myEffectiveTraceState = synCtx.getTracingState();
if (this instanceof SequenceMediator) {
if (this instanceof SequenceMediator & mediatorPosition == 0) {
List<SequenceFlowObserver> observers = synCtx.getEnvironment().getSequenceObservers();
for (SequenceFlowObserver observer : observers) {
observer.start(synCtx, ((SequenceMediator) this).getName());
Expand Down Expand Up @@ -112,6 +112,14 @@ public boolean mediate(MessageContext synCtx, int mediatorPosition) {
returnVal = false;
break;
}
if (i == mediators.size() - 1) {
if (this instanceof SequenceMediator) {
List<SequenceFlowObserver> observers = synCtx.getEnvironment().getSequenceObservers();
for (SequenceFlowObserver observer : observers) {
observer.complete(synCtx, ((SequenceMediator) this).getName());
}
}
}
mediator.reportCloseStatistics(synCtx, statisticReportingIndex);
} else {
synCtx.setTracingState(myEffectiveTraceState);
Expand Down

0 comments on commit 518f56d

Please sign in to comment.