Quantcast
Channel: GlassFish Related Items on Java.net
Viewing all articles
Browse latest Browse all 1091

There are some questions about The Improvement of BaseContainer#postInvoke(Invocation inv, boolean doTxProcessing) method

$
0
0

Hi

I have some questions about the following method in glassfish V3:
-------------------------------------------------------------------------------------------------
Component: ejb_container

class: com.sun.ejb.containers.BaseContainer

method:postInvoke(invocation inv, boolean doTxProcessing)

postInvoke(Invocation inv, boolean doTxProcessing) {
......
if ( inv.ejb != null ) {
// counterpart of invocationManager.preInvoke
if (! inv.useFastPath) {
invocationManager.postInvoke(inv);
if (isStatefulSession && (((EJBContextImpl) inv.context).getTransaction() != null)) {
SessionContextImpl sessionCtx = (SessionContextImpl) inv.context;
JavaEETransaction j2eeTx = (JavaEETransaction) sessionCtx .getTransaction();

Map entityManagerMap = sessionCtx .getExtendedEntityManagerMap();
for (EntityManagerFactory emf : entityManagerMap.keySet()) {

if (sessionCtx.isEmfRegisteredWithTx(emf)) {
j2eeTx.removeExtendedEntityManagerMapping(emf);
sessionCtx.setEmfRegisteredWithTx(emf, false);
}
}
}
} else {
doTxProcessing = doTxProcessing && (inv.exception != null);
}

try {
if( doTxProcessing ) {
postInvokeTx(inv);
}
} catch (Exception ex) {
_logger.log(Level.FINE, "ejb.postinvoketx_exception", ex);
}
......

}
------------------------------------------------------------------

glassfish V2 compare with glassfish V3 it has some changes,
changes as following:

the logic of the method In glassfish V2:

1:first execute the following code

----------------------------------

if ( doTxProcessing ) {

postInvokeTx(inv);

}

----------------------------------

2: then execute the following code:
----------------------------------

invocationManager.postInvoke(inv);

----------------------------------

the logic of the method In glassfish V3:

1:first execute the following code
----------------------------------

invocationManager.postInvoke(inv);

----------------------------------

2: then execute the following code:
----------------------------------

if ( doTxProcessing ) {

postInvokeTx(inv);

}
----------------------------------

Why do this change?

If I execute the following code in glassfish V3 ,what will happen?

1:first execute the following code
----------------------------------

if ( doTxProcessing ) {

postInvokeTx(inv);

}
----------------------------------

2: then execute the following code:
----------------------------------

invocationManager.postInvoke(inv);
----------------------------------


Viewing all articles
Browse latest Browse all 1091

Trending Articles