Skip to content

Commit 8c372d1

Browse files
committed
copy LogEvent from restricted context up to its parent
1 parent d9c8614 commit 8c372d1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

jpos/src/main/java/org/jpos/transaction/TransactionManager.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import org.jpos.iso.ISOUtil;
6060
import org.jpos.util.Metrics;
6161

62+
import static org.jpos.transaction.ContextConstants.LOGEVT;
6263
import static org.jpos.transaction.ContextConstants.TIMESTAMP;
6364

6465
@SuppressWarnings("unchecked")
@@ -1164,6 +1165,18 @@ private int prepareOrAbort (TransactionParticipant p, long id, Serializable cont
11641165
} else {
11651166
Context c = ctx.clone(pp.requires.toArray(), pp.optional.toArray());
11661167
action = preparationFunction.apply(p, id, c);
1168+
if (!pp.requires.contains(LOGEVT.toString())) {
1169+
// if we are not inheriting parent's log event and there's a log event
1170+
// in the childs context, copy it.
1171+
LogEvent evt = c.get(LOGEVT.toString());
1172+
if (evt != null) {
1173+
LogEvent parentLogEvent = ctx.getLogEvent();
1174+
synchronized (parentLogEvent) {
1175+
parentLogEvent.getPayLoad().addAll(evt.getPayLoad());
1176+
}
1177+
c.remove(LOGEVT.toString());
1178+
}
1179+
}
11671180
ctx.merge(c.clone(pp.provides.toArray()));
11681181
}
11691182
} else {

0 commit comments

Comments
 (0)