Methods Summary |
---|
void | addBean(EJBContextImpl bean)
beans.add(bean);
|
void | addPMSynchronization(javax.transaction.Synchronization sync)
pmSyncs.add(sync);
|
void | addTimerSynchronization(TimerPrimaryKey timerId, javax.transaction.Synchronization sync)
timerSyncs.put(timerId, sync);
|
public void | afterCompletion(int status)
for ( int i=0; i<pmSyncs.size(); i++ ) {
Synchronization sync = (Synchronization)pmSyncs.elementAt(i);
try {
sync.afterCompletion(status);
} catch ( Exception ex ) {
_logger.log(Level.SEVERE, "ejb.after_completion_error", ex);
}
}
// call afterCompletion for each bean instance
for ( int i=0; i<beans.size();i++ ) {
EJBContextImpl context = (EJBContextImpl)beans.get(i);
BaseContainer container = (BaseContainer)context.getContainer();
try {
if( container != null ) {
container.afterCompletion(context, status);
} else {
// Might be null if bean was removed. Just skip it.
_logger.log(Level.FINE, "context with empty container in "
+
" ContainerSynchronization.afterCompletion");
}
} catch ( Exception ex ) {
_logger.log(Level.SEVERE, "ejb.after_completion_error", ex);
}
}
if (sfsbTxCoordinator != null) {
sfsbTxCoordinator.doTxCheckpoint();
}
for ( Iterator iter = timerSyncs.values().iterator();
iter.hasNext(); ) {
Synchronization timerSync = (Synchronization) iter.next();
try {
timerSync.afterCompletion(status);
} catch ( Exception ex ) {
_logger.log(Level.SEVERE, "ejb.after_completion_error", ex);
}
}
// tell ContainerFactory to remove this tx/sync from its table
containerFactory.removeContainerSync(tx);
|
public void | beforeCompletion()
// first call beforeCompletion for each bean instance
for ( int i=0; i<beans.size(); i++ ) {
EJBContextImpl context = (EJBContextImpl)beans.get(i);
BaseContainer container = (BaseContainer)context.getContainer();
try {
if( container != null ) {
if (container.isUndeployed()) {
_logger.log(Level.WARNING, "Marking Tx for rollback "
+ " because container for " + container
+ " is undeployed");
try {
tx.setRollbackOnly();
} catch (SystemException sysEx) {
_logger.log(Level.FINE, "Error while trying to "
+ "mark for rollback", sysEx);
}
} else {
container.beforeCompletion(context);
}
} else {
// Might be null if bean was removed. Just skip it.
_logger.log(Level.FINE, "context with empty container in " +
" ContainerSynchronization.beforeCompletion");
}
} catch ( Exception ex ) {
// rollback the Tx. The client will get
// a EJB/RemoteException or a TransactionRolledbackException.
_logger.log(Level.SEVERE,"ejb.remote_or_txnrollback_exception",ex);
try {
tx.setRollbackOnly();
} catch ( SystemException e ) {
_logger.log(Level.FINE, "", ex);
}
return; // no need to call remaining beforeCompletions
}
}
// now call beforeCompletion for all pmSyncs
for ( int i=0; i<pmSyncs.size(); i++ ) {
Synchronization sync = (Synchronization)pmSyncs.elementAt(i);
try {
sync.beforeCompletion();
} catch ( Exception ex ) {
// rollback the Tx. The client will get
// a EJB/RemoteException or a TransactionRolledbackException.
_logger.log(Level.SEVERE,"ejb.remote_or_txnrollback_exception",ex);
try {
tx.setRollbackOnly();
} catch ( SystemException e ) {
_logger.log(Level.FINE, "", ex);
}
return; // no need to call remaining beforeCompletions
}
}
|
java.util.Vector | getBeanList()
Vector vec = new Vector();
for (Iterator iter = beans.iterator(); iter.hasNext(); ) {
vec.add(iter.next());
}
return vec;
|
javax.transaction.Synchronization | getTimerSynchronization(TimerPrimaryKey timerId)
return (Synchronization) timerSyncs.get(timerId);
|
void | registerForTxCheckpoint(SessionContextImpl sessionCtx)
//No need to synchronize
if (sfsbTxCoordinator == null) {
sfsbTxCoordinator = new SFSBTxCheckpointCoordinator();
}
sfsbTxCoordinator.registerContext(sessionCtx);
|
void | removeBean(EJBContextImpl bean)
beans.remove(bean);
|
void | removeTimerSynchronization(TimerPrimaryKey timerId)
timerSyncs.remove(timerId);
|