Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*    */ package org.jboss.ejb3.entity;
 /*    */ 
 /*    */ import java.util.Collection;
 /*    */ import java.util.IdentityHashMap;
 /*    */ import java.util.Iterator;
 /*    */ import java.util.Map;
 /*    */ import javax.persistence.EntityManager;
 /*    */ import org.jboss.aop.advice.Interceptor;
 /*    */ import org.jboss.aop.joinpoint.Invocation;
/*    */ import org.jboss.ejb3.ThreadLocalStack;
/*    */ import org.jboss.logging.Logger;
/*    */ 
/*    */ public class TransactionScopedEntityManagerInterceptor
/*    */   implements Interceptor
/*    */ {
/* 42 */   private static final Logger log = Logger.getLogger(TransactionScopedEntityManagerInterceptor.class);
/*    */ 
/*    */   public String getName()
/*    */   {
/* 46 */     return getClass().getName();
/*    */   }
/*    */ 
/*    */   public Object invoke(Invocation invocationthrows Throwable {
/*    */     Iterator i$;
/*    */     try {
/* 53 */       ManagedEntityManagerFactory.nonTxStack.push(new IdentityHashMap());
/* 54 */       Object localObject1 = invocation.invokeNext();
/*    */       Map map;
/*    */       Iterator i$;
/*    */       Object obj;
/*    */       return localObject1;
/*    */     }
/*    */     finally
/*    */     {
/* 58 */       Map map = (Map)ManagedEntityManagerFactory.nonTxStack.pop();
/* 59 */       for (i$ = map.values().iterator(); i$.hasNext(); ) { Object obj = i$.next();
/*    */         try
/*    */         {
/* 63 */           ((EntityManager)obj).close();
/* 64 */           log.debug("********************* CLOSING tx scoped nontx entity manager");
/*    */         }
/*    */         catch (Exception ignored)
/*    */         {
/*    */         } }
/*    */     }
/* 70 */     throw localObject2;
/*    */   }
/*    */ }
/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
 * Qualified Name:     org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor
 * JD-Core Version:    0.6.0
 */
New to GrepCode? Check out our FAQ X