Package org.jboss.ejb

Examples of org.jboss.ejb.InstancePool


/* 133 */     EntityContainer ec = (EntityContainer)this.container;
/*     */     InvocationType type;
/* 134 */     if ((mi.getTransaction() == null) ||
/* 138 */       (ctx == null))
/*     */     {
/* 140 */       InstancePool pool = ec.getInstancePool();
/*     */       try
/*     */       {
/* 143 */         ctx = (EntityEnterpriseContext)pool.get();
/*     */       }
/*     */       catch (EJBException e)
/*     */       {
/* 147 */         throw e;
/*     */       }
View Full Code Here


/*     */
/*     */   public Object invoke(Invocation mi)
/*     */     throws Exception
/*     */   {
/*  81 */     MessageDrivenContainer mdc = (MessageDrivenContainer)this.container;
/*  82 */     InstancePool pool = mdc.getInstancePool();
/*  83 */     EnterpriseContext ctx = null;
/*     */     try
/*     */     {
/*  86 */       ctx = pool.get();
/*     */     }
/*     */     catch (EJBException e)
/*     */     {
/*  90 */       throw e;
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/*  94 */       throw new EJBException("Unable to get an instance from the pool", e);
/*     */     }
/*     */
/*  98 */     ctx.setPrincipal(mi.getPrincipal());
/*     */
/* 101 */     mi.setEnterpriseContext(ctx);
/*     */
/* 103 */     EnterpriseBeanPolicyContextHandler.setEnterpriseBean(ctx.getInstance());
/*     */
/* 105 */     if (ejbTimeout.equals(mi.getMethod()))
/* 106 */       AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_TIMEOUT);
/*     */     else {
/* 108 */       AllowedOperationsAssociation.pushInMethodFlag(IN_BUSINESS_METHOD);
/*     */     }
/*     */
/*     */     try
/*     */     {
/* 115 */       Object obj = getNext().invoke(mi);
/* 116 */       localObject1 = obj;
/*     */     }
/*     */     catch (RuntimeException e)
/*     */     {
/*     */       Object localObject1;
/* 120 */       mi.setEnterpriseContext(null);
/* 121 */       throw e;
/*     */     }
/*     */     catch (RemoteException e)
/*     */     {
/* 125 */       mi.setEnterpriseContext(null);
/* 126 */       throw e;
/*     */     }
/*     */     catch (Error e)
/*     */     {
/* 130 */       mi.setEnterpriseContext(null);
/* 131 */       throw e;
/*     */     }
/*     */     finally
/*     */     {
/* 135 */       AllowedOperationsAssociation.popInMethodFlag();
/* 136 */       EnterpriseBeanPolicyContextHandler.setEnterpriseBean(null);
/*     */
/* 139 */       if (mi.getEnterpriseContext() != null)
/*     */       {
/* 141 */         pool.free((EnterpriseContext)mi.getEnterpriseContext());
/*     */       }
/*     */       else
/*     */       {
/* 145 */         pool.discard(ctx);
/*     */       }
/*     */     }
/*     */   }
View Full Code Here

/*     */     throws Exception
/*     */   {
/* 113 */     EntityContainer container = (EntityContainer)getContainer();
/* 114 */     EntityEnterpriseContext ctx = (EntityEnterpriseContext)container.getInstancePool().get();
/* 115 */     ctx.setTxAssociation(GlobalTxEntityMap.NOT_READY);
/* 116 */     InstancePool pool = container.getInstancePool();
/*     */
/* 119 */     mi.setEnterpriseContext(ctx);
/*     */
/* 122 */     ctx.setTransaction(mi.getTransaction());
/*     */
/* 124 */     ctx.setSecurityContext(mi.getSecurityContext());
/*     */
/* 126 */     ctx.setPrincipal(mi.getPrincipal());
/*     */
/* 128 */     AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_HOME);
/*     */
/* 132 */     Object obj = null;
/* 133 */     Exception exception = null;
/*     */     try
/*     */     {
/* 137 */       obj = getNext().invokeHome(mi);
/*     */
/* 140 */       if (ctx.getId() != null)
/*     */       {
/* 142 */         BeanLock lock = container.getLockManager().getLock(ctx.getCacheKey());
/* 143 */         lock.sync();
/*     */         try
/*     */         {
/* 149 */           cache = container.getInstanceCache();
/* 150 */           cache.remove(ctx.getCacheKey());
/*     */
/* 154 */           cache.insert(ctx);
/*     */         }
/*     */         finally
/*     */         {
/* 158 */           lock.releaseSync();
/* 159 */           container.getLockManager().removeLockRef(ctx.getCacheKey());
/*     */         }
/*     */
/* 163 */         InstanceCache cache = obj;
/*     */         return cache;
/*     */       }
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 168 */       exception = e;
/*     */     }
/*     */     finally
/*     */     {
/* 172 */       AllowedOperationsAssociation.popInMethodFlag();
/*     */     }
/*     */
/* 175 */     ctx.setTransaction(null);
/*     */
/* 177 */     mi.setEnterpriseContext(null);
/*     */
/* 181 */     if (exception == null)
/*     */     {
/* 183 */       container.getInstancePool().free(ctx);
/* 184 */       return obj;
/*     */     }
/*     */
/* 187 */     if ((exception instanceof RuntimeException))
/*     */     {
/* 191 */       pool.discard(ctx);
/*     */     }
/*     */     else
/*     */     {
/* 198 */       pool.free(ctx);
/*     */     }
/*     */
/* 201 */     throw exception;
/*     */   }
View Full Code Here

/*     */   }
/*     */
/*     */   public Object invokeHome(Invocation mi)
/*     */     throws Exception
/*     */   {
/*  89 */     InstancePool pool = this.container.getInstancePool();
/*  90 */     StatelessSessionEnterpriseContext ctx = null;
/*     */     try
/*     */     {
/*  94 */       ctx = (StatelessSessionEnterpriseContext)pool.get();
/*  95 */       mi.setEnterpriseContext(ctx);
/*     */
/*  97 */       localObject1 = getNext().invokeHome(mi);
/*     */     }
/*     */     finally
/*     */     {
/*     */       Object localObject1;
/* 101 */       mi.setEnterpriseContext(null);
/*     */
/* 103 */       if (ctx != null)
/* 104 */         pool.free(ctx);
/*     */     }
/*     */   }
View Full Code Here

/* 104 */         pool.free(ctx);
/*     */     }
/*     */   }
/*     */
/*     */   public Object invoke(Invocation mi) throws Exception {
/* 112 */     InstancePool pool = this.container.getInstancePool();
/* 113 */     StatelessSessionEnterpriseContext ctx = null;
/*     */     boolean isLocal;
/*     */     try {
/* 116 */       ctx = (StatelessSessionEnterpriseContext)pool.get();
/*     */     }
/*     */     catch (EJBException e)
/*     */     {
/* 120 */       throw e;
/*     */     }
/*     */     catch (RemoteException e)
/*     */     {
/* 124 */       throw e;
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 128 */       InvocationType type = mi.getType();
/* 129 */       isLocal = (type == InvocationType.LOCAL) || (type == InvocationType.LOCALHOME);
/* 130 */       if (isLocal) {
/* 131 */         throw new EJBException("Unable to get an instance from the pool", e);
/*     */       }
/* 133 */       throw new RemoteException("Unable to get an intance from the pool", e);
/*     */     }
/*     */
/* 137 */     ctx.setSecurityContext(mi.getSecurityContext());
/*     */
/* 139 */     ctx.setPrincipal(mi.getPrincipal());
/*     */
/* 141 */     EnterpriseBeanPolicyContextHandler.setEnterpriseBean(ctx.getInstance());
/*     */
/* 144 */     mi.setEnterpriseContext(ctx);
/*     */
/* 147 */     Object msgContext = mi.getValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
/*     */
/* 150 */     if (ejbTimeout.equals(mi.getMethod()))
/*     */     {
/* 152 */       AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_TIMEOUT);
/*     */     }
/* 156 */     else if (msgContext != null)
/*     */     {
/* 158 */       if ((msgContext instanceof MessageContext)) {
/* 159 */         ctx.setMessageContext((MessageContext)msgContext);
/*     */       }
/* 161 */       AllowedOperationsAssociation.pushInMethodFlag(IN_SERVICE_ENDPOINT_METHOD);
/*     */     }
/*     */     else
/*     */     {
/* 167 */       AllowedOperationsAssociation.pushInMethodFlag(IN_BUSINESS_METHOD);
/*     */     }
/*     */
/*     */     try
/*     */     {
/* 174 */       Object obj = getNext().invoke(mi);
/* 175 */       isLocal = obj;
/*     */     }
/*     */     catch (RuntimeException e)
/*     */     {
/* 180 */       mi.setEnterpriseContext(null);
/* 181 */       throw e;
/*     */     }
/*     */     catch (RemoteException e)
/*     */     {
/* 185 */       mi.setEnterpriseContext(null);
/* 186 */       throw e;
/*     */     }
/*     */     catch (Error e)
/*     */     {
/* 190 */       mi.setEnterpriseContext(null);
/* 191 */       throw e;
/*     */     }
/*     */     finally
/*     */     {
/* 195 */       AllowedOperationsAssociation.popInMethodFlag();
/* 196 */       EnterpriseBeanPolicyContextHandler.setEnterpriseBean(null);
/*     */
/* 199 */       if (mi.getEnterpriseContext() != null)
/*     */       {
/* 201 */         pool.free((EnterpriseContext)mi.getEnterpriseContext());
/*     */       }
/*     */       else
/*     */       {
/* 205 */         pool.discard(ctx);
/*     */       }
/*     */     }
/*     */   }
View Full Code Here

TOP

Related Classes of org.jboss.ejb.InstancePool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.