/* 57 */ StatefulContainerInvocation ejbInv = (StatefulContainerInvocation)invocation;
/* 58 */ StatefulBeanContext ctx = (StatefulBeanContext)ejbInv.getBeanContext();
/* 59 */ StatefulBeanContext root = ctx.getUltimateContainedIn();
/* */
/* 62 */ boolean clustered = false;
/* 63 */ StatefulContainer container = (StatefulContainer)root.getContainer();
/* 64 */ ClusteredStatefulCache clusteredCache = null;
/* 65 */ if ((container.getCache() instanceof ClusteredStatefulCache))
/* */ {
/* 67 */ clustered = true;
/* 68 */ clusteredCache = (ClusteredStatefulCache)container.getCache();
/* */ }
/* */
/* 73 */ if (clustered) {
/* 74 */ pushCallStack(root);
/* */ }
/* 76 */ boolean stackUnwound = false;
/* 77 */ Object rtn = null;
/* */ try
/* */ {
/* 80 */ rtn = invocation.invokeNext();
/* */ }
/* */ finally
/* */ {
/* 84 */ stackUnwound = (clustered) && (isCallStackUnwound(root));
/* */ }
/* */
/* 90 */ boolean mustReplicate = clustered;
/* */
/* 95 */ Object obj = invocation.getTargetObject();
/* 96 */ if ((obj instanceof Optimized))
/* */ {
/* 98 */ if (!((Optimized)obj).isModified())
/* */ {
/* 100 */ mustReplicate = false;
/* */ }
/* */ }
/* */
/* 104 */ if (mustReplicate)
/* */ {
/* 109 */ root.markedForReplication = true;
/* */ }
/* */
/* 112 */ if ((stackUnwound) && (root.markedForReplication))
/* */ {
/* 114 */ clusteredCache.replicate(root);
/* */ }
/* */
/* 117 */ if ((ctx != root) && (ctx.markedForReplication))
/* */ {
/* 122 */ container = (StatefulContainer)ctx.getContainer();
/* 123 */ StatefulCache cache = container.getCache();
/* 124 */ if ((cache instanceof ClusteredStatefulCache))
/* */ {
/* 126 */ clusteredCache = (ClusteredStatefulCache)cache;
/* 127 */ clusteredCache.replicate(ctx);
/* */ }