Skip to content

Commit

Permalink
[JBPM-10187] Adding traces for session info loading
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtirado committed Aug 17, 2023
1 parent be46da7 commit 613fac1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ protected javax.transaction.TransactionManager findTransactionManager(UserTransa
jndiName );
return tm;
} catch ( NamingException ex ) {
logger.debug( "No JTA TransactionManager found at fallback JNDI location [{}]",
logger.debug( "No JTA TransactionManager found at fallback JNDI location [{}]. Exception message {}",
jndiName,
ex);
ex.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

public class JpaPersistenceContext implements PersistenceContext {

private static Logger logger = LoggerFactory.getLogger(JpaPersistenceContext.class);
protected static Logger logger = LoggerFactory.getLogger(JpaPersistenceContext.class);

private EntityManager em;
protected final boolean isJTA;
Expand Down Expand Up @@ -68,7 +68,7 @@ public PersistentSession persist(PersistentSession entity) {
}

public PersistentSession findSession(Long id) {

logger.trace("Reading session info {}, id");
SessionInfo sessionInfo = null;
if( this.pessimisticLocking ) {
sessionInfo = this.em.find( SessionInfo.class, id, lockMode );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,19 @@ private boolean isEntity(Object o){
public void onStart(TransactionManager txm) {
if (persister.get() == null) {
EntityManager em = emf.createEntityManager();
log.trace ("Created EM {} for name {}",em, name);
persister.set(new EntityPersister(em));
}
}

@Override
public void onEnd(TransactionManager txm) {
EntityPersister em = persister.get();
if (em == null) {
log.warn ("EM is null for {} and status {}", name, txm.getStatus());
return;
}
log.trace ("Executing onEnd for {} with status {}", name, txm.getStatus());
if(txm.getStatus() == TransactionManager.STATUS_ROLLEDBACK) {
// this is pretty much of a hack but for avoiding issues when rolling back we need to set to null
// the primary key of the entities (simple types)
Expand Down Expand Up @@ -239,6 +245,7 @@ public void onEnd(TransactionManager txm) {
});
}
if (em != null) {
log.trace ("Closing EM {} for name {}",em, name);
em.close();
persister.set(null);
}
Expand Down

0 comments on commit 613fac1

Please sign in to comment.